All Questions
Tagged with python matplotlib
62,921 questions
0
votes
1
answer
17
views
Matplotlib quiver colormap
I'm trying to plot interpolated velocity data from Fluent in Python. Interpolated velocity vector components are normalized by size and plotted with quiver function. I'm trying to represent the ...
2
votes
2
answers
87
views
How could I zoom in on a generated Mandelbrot set without consuming too many resources?
I am trying to make a Mandelbrot set display, with the following code:
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['toolbar'] = 'None'
def mandelbrot(c, max_iter):
z = 0
...
0
votes
1
answer
42
views
Matplotlib figure with 2 animation subplots: how to update both
I'm trying to vizualize simulation results with a figure containing 2 subplots using matplotlib pyplot. Both should contain animation: one uses netgraph library (it's a graph with nodes showing flows ...
0
votes
1
answer
56
views
log-log time series plot with event markers
I want to create a log-log plot showing the growth of publications over time (papers/year), similar to scientific figures like Fig. 1a in "A Century of Physics" (Nature Physics 2015).
...
0
votes
1
answer
42
views
Determine actual data in 3 way Venn segment? Python
I've successfully generated a 3 way venn using matplotlib for 3 dataframes (dfA,dfB and dfC) as per the attached picture. However, I'm struggling on the code to ascertain exactly what data is in the '...
0
votes
3
answers
48
views
How can I stop a matplotlib table overlapping a graph?
The MWE below produces a plot like this:
The row labels, X, Y, Z, overlap the right hand side of the bar chart in an ugly fashion. I'd like them moved further to the right, leaving a small margin ...
1
vote
1
answer
87
views
plt.contour() plots series of lines instead of a contour line
I aim to plot a contour plot of flux, but instead of closed contour curves, plt.contour() returns a series of lines with the same height.
Psi is defined as a np.array and has a 320 by 200 shape.
fig, ...
-3
votes
1
answer
95
views
How to reduce the space between bars in a Matplotlib chart?
I’m trying to create a simple bar chart using matplotlib to visualize the number of students per department. How can I reduce the space between the bars?
import matplotlib.pyplot as plt
departments = ...
-1
votes
0
answers
45
views
'FigureCanvasInterAgg' object has no attribute 'tostring_rgb' error in Python [duplicate]
I currently get this error message all the time when I run Python and Matplotlib on my MacBook Pro M1.
Traceback (most recent call last):
File "/main.py", line 357, in <module>
...
1
vote
1
answer
54
views
Linear regression prediction does not display properly
I want to make 2 different linear regressions for 2 diferent plots, but on the same figure. I have a problem with the y1_pred because it does not go for all the y axis where are scatters.
model1 = ...
1
vote
1
answer
65
views
Matplotlib vertical grid lines not match points
Could you please explain why vertical grid lines not match points?
Here is my data for plot:
{datetime.datetime(2025, 4, 15, 19, 23, 50, 658000, tzinfo=datetime.timezone.utc): 68.0, datetime.datetime(...
0
votes
1
answer
25
views
Basemap plots in Matplotlib have cutoff map boundary lines
When trying to create a grid of maps in matplotlib using the Basemap toolkit, I noticed that the line that bounds the map projection is cut off on all four sides.
Look at the following minimal example ...
0
votes
1
answer
57
views
Can't Align Histogram Bin Edges with Chart Even When Using Numpy histogram_bin_edges
I want the histogram edges to line up with the xticks of my chart. Other SO and answers I've read focus on calculating the bins and passing them. I've done this yet still can't get them to align:
I'...
1
vote
1
answer
106
views
UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
I am trying to show a matplotlib.pyplot figure on Python 3.10 but can't. I am aware of this question and tried their answers but is still unsuccessful. The default OS distribution is Ubuntu 24.04 ...
-3
votes
1
answer
39
views
Saving subplots in matplotlib as separate images
I am trying to save the six subplots I have created into separate image files. I can only get it to save the first subplot. How do I get it to save all 6 separately?
Here is my code:
# define the ...