Skip to main content

New answers tagged

Tooling
0 votes
0 replies
0 views

I am working on programming a Cartesian & Polar Parametric Grapher with python, any library recommendations?

For a parametric grapher like: "https://www.calculators-math.com/graphers/parametric-curve/" Core stack: Matplotlib + NumPy import numpy as np import matplotlib.pyplot as plt t = np....
noves digital's user avatar
1 vote

how to start colorbar at value 0 without changing the coloring

you could do something like this: import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl # Generate data to display shape = (16, 16) data = np.random.standard_normal(shape) ...
MrXerios's user avatar
  • 382
0 votes
Accepted

Seaborn plot with lines inbetween pairs of data points showing value differences

You could use Axes.vlines on top of the scatter plot: import seaborn as sns plot = sns.scatterplot(data=by_sent_type, s=50) plot.set(xlabel='pair', ylabel='surprisal') plot.vlines( x=by_sent_type....
mozway's user avatar
  • 267k
0 votes

Seaborn plot with lines inbetween pairs of data points showing value differences

what you want is called a slope chart because the seaborn doesnt do it natively but you can just layer it with matplotlib like this: for i, row in by_sent_type.iterrows(): ax.plot(["ungapped&...
Jared McCarthy's user avatar
2 votes

How to draw a tree more beautifully in networkx

Joel's answer is the way to go if you are looking for a solution that doesn't use any additional libraries but are okay writing extra functions. If you are looking for a networkx one-liner, consider ...
JEdwards's user avatar
3 votes

Add outline to the 3D barchart

matplotlib's bar3d isn't designed to display a bar graph with gradient colors. This is an interesting workaround to do so, but I don't see a way to add an outline to it that wouldn't make it look like ...
MrXerios's user avatar
  • 382
Advice
0 votes
0 replies
0 views

How does one make a player diagram/visualization like the one below within Python?

After watching on this page a similar example of that chart (and while browsing as well), I think that you could try the following: Use Photoshop (or any other way) for modify the image of a cropped ...
Mauricio Arias Olave's user avatar
Advice
0 votes
0 replies
0 views

How does one make a player diagram/visualization like the one below within Python?

Matplotlib- I’m fairly confident this was used to draw the outline of the pitcher, as this is commonly used to draw field dimensions when making spray charts within python. Charts- This is a charting ...
Jole77's user avatar
  • 1
Advice
0 votes
0 replies
0 views

How does one make a player diagram/visualization like the one below within Python?

why did you use the matplotlib, charts and data-analysis tags? ... how are they relevant to the picture?
jsotola's user avatar
  • 2,254
Advice
0 votes
0 replies
0 views

How does one make a player diagram/visualization like the one below within Python?

what is neat about the picture?
jsotola's user avatar
  • 2,254
Best practices
0 votes
0 replies
0 views

How do I implement a cylindrical grid for a 3D plot?

You should care about legibility and reader psychofidelity first, and what you consider to be attractive about fourth. Psychofidelity is only harmed and not helped by insisting on a three-dimensional ...
Reinderien's user avatar
0 votes

Plotting a histogram from pre-counted data in Matplotlib

It's similar to Josh Rosen's answer, but I just wanted to point out this part of the Matplotlib documentation for the hist() function: If the data has already been binned and counted, use bar or ...
Ignacio HM's user avatar
0 votes

How can I plot an interactive matplotlib figure without the figure number in a Jupyter notebook?

For Notebook version >= 7 you can do fig.canvas.header_visible = False This works just as well for me as fig.set_label(' '), but you can also do things like fig.canvas.footer_visible = False fig....
Franz Knülle's user avatar
0 votes

KeyError : 'geo' when attempting to add GeoAxes using axes.inset_axes

Another solution for this is to simply import cartopy before importing matplotlib. That sorted the issue for me.
Monobakht's user avatar
  • 303
2 votes

Boxplot Min/Max Values and Overlaying Points Issues

There are some misunderstandings here about what's going on that should be addressed: It's not that the "error bars" (the whiskers) aren't showing up, it's that the "missing" bars ...
Ben Grossmann's user avatar
1 vote

How to wrap long tick labels in a seaborn figure-level plot

Adding to the answer https://stackoverflow.com/a/68954616/14776523 you should respect the warning: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks(...
pas-calc's user avatar
  • 310
1 vote

Smooth colormap in matplotlib

I can offer a quick hack solution based on your existing structure that should probably be good enough for its intended purpose. To do any better would require computing just noticeable differences ...
Martin Brown's user avatar
  • 3,865
2 votes
Accepted

Conditionally format color of tick mark in matplotlib

The following should work: import numpy as np import matplotlib.pyplot as plt new_ticks = [2.0, 2.75] a = np.array([1,2,3,4,5]) b = np.array([1,2,3,4,5]) # plot the data fig, ax = plt.subplots() ax....
Matt Pitkin's user avatar
  • 7,480
2 votes

Conditionally format color of tick mark in matplotlib

Since you need to mark the ticks that are not presented yet, why not just move the: index_d = xticks.index(d) plt.gca().get_xticklines()[index_d].set_markeredgecolor('red') inside the if ...
Jun's user avatar
  • 17
-1 votes

Is it possible to map matplotlib polygon vertices into an array?

Here is my answer based on my understanding that the shp will be a list of zip of the polygon's (x, y) coordinates (CMIIW). I have not tried it, so I can't ensure if it will work. mask_array = np....
Jun's user avatar
  • 17
2 votes
Accepted

matplotlib axes3d how to use all window space plotting

There is a related post on matplotlib's discourse: How to turn off all clipping?. As the first answerer to that thread wrote, basically "some clipping is [always] desired", meaning that all ...
musicamante's user avatar
0 votes

Is it possible to iteratively build up legend entries through multiple plot function calls?

I recently encountered the same problem and came up with two solutions. The way I see it, this is a matter of having some shared context keep the extra information in. If you are using non tuple ...
Lorenz's user avatar
  • 1
0 votes

Matplotlib - Boxplot calculated on log10 values but shown in logarithmic scale

I just ran into this, and I wanted to calculate the boxplot in log space to avoid the fliers, while rendering with proper minor yticks and gridlines as you would get when using a log yscale. My ...
pbsds's user avatar
  • 271
1 vote
Accepted

How do I embed a FigureCanvasTkAgg in a class?

First of all your attempt to put your code into your class didn't work well, because of your indention. Look into Short description of the scoping rules. You got one indention deep, meaning your ...
Thingamabobs's user avatar
  • 8,256
Advice
0 votes
0 replies
0 views

Plot time evolution of a function y(x, t) in matplotlib (Python) where y and x are parameterized

You'll need to create a 2d array that contains the x-values as a function of time.
Matt Pitkin's user avatar
  • 7,480
Advice
1 vote
0 replies
0 views

Plot time evolution of a function y(x, t) in matplotlib (Python) where y and x are parameterized

But what should I set as x_vals, seeing as I have no constant list of values of x over which y should be plotted at each instant in time?
Thanos's user avatar
  • 101
Advice
0 votes
0 replies
0 views

Plot time evolution of a function y(x, t) in matplotlib (Python) where y and x are parameterized

From what I can tell from your question, I think that in your equivalent of the update2d function from the linked solution, you just need to switch the two uses of xdata in the function to xdata[frame,...
Matt Pitkin's user avatar
  • 7,480
0 votes

Can fill_between range to infinty with custom transform?

A bit late, but since I was searching for a solution myself... I don't think a custom transform is feasible here since both y0 and y1 will always be transformed with the same y-transform. What you can ...
raphael's user avatar
  • 3,188
2 votes
Accepted

Python Matplotlib: Animation does not update plot alongside series of images

I've reviewed the code, and I think the reason you're encountering this issue is that the range of the logarithmic axis is not being updated automatically, causing the data points to fall outside the ...
autext's user avatar
  • 104
-3 votes

How to plot time vs value graph using python

import matplotlib.pyplot as plt # Data points time = [0, 10, 20, 30, 40, 50, 60, 70, 80] velocity = [0, 5, 10, 15, 15, 15, 10, 5, 0] # Plotting the graph plt.plot(time, velocity, marker='o', linestyle=...
Mike Justine Agbayani's user avatar
2 votes

Matplotlib update AnnotationBBox position

The 3-D in mplot3d doesn't have any support for AnnotationBbox. I don't think using ann.se_position will do anything different from updating the data coordinates of the annotation. Another option is ...
Linda's user avatar
  • 37

Top 50 recent answers are included