Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
127 views

I have a plot with 3 subplots: the top plot is larger than the two subsequent plots. They all share the same x- and y-axis. However, the ylabel is rather long, so the ylabels of the two bottom plots ...
Niklas Netter's user avatar
1 vote
2 answers
372 views

I am trying to do a Gridspec with this layout: Layout looking as it is supposed to The lower left plot is supposed to be of equal aspect ratio. Sadly, I had to adjust the window size to get this ...
RaphBilder's user avatar
0 votes
0 answers
37 views

Ηi, I want to create a grid of plots that each plot has a subplot. The reason for this is that one of my columns (area1) has very high values compared to the other (area2, area3), therefore making the ...
Anas.S's user avatar
  • 305
1 vote
0 answers
29 views

I want a specific subplot layout and found GridSpec to have this possibility. Here, the upper chart is a bar plot of the counts per date, the left is a bar plot of the counts per variable (over dates) ...
Thomasius Wa's user avatar
1 vote
1 answer
117 views

I'm trying to make 3 pairs of subplots, with more space between the pairs. But I can't independently change the space between the pairs. I'm using nested GridSpecs following this answer. from ...
wfsch's user avatar
  • 31
0 votes
1 answer
53 views

I am trying to plot three plots on one figure. Left two are just regular plots, but the top right one needs to be a correlation matrix with three additional colorbars, but I can't seem to get the ...
Jaka Kovše's user avatar
0 votes
1 answer
50 views

I need to update grid parameters (visible, which, axis, **kwargs) to customize the major and minor grid lines style. i tried using plt.grid(which='minor', linewidth=0.5, linestyle='dotted') but it did ...
Hannibal's user avatar
  • 123
2 votes
1 answer
83 views

I have an image that I am displaying with imshow. Then I add all the rows and show maximum values. I do the same for the columns. On the display plot, I would like to make the x and y axis of the ...
lchavez's user avatar
  • 85
0 votes
0 answers
40 views

Wondering if someone can help explain why the first code block runs fine, while the second code block throws this error: > ---------------------------------------------------------------------------...
sophivar's user avatar
0 votes
1 answer
314 views

I am struggling finding a way to keep the projection of the image completely aligned to the image (as in the figure below) but at the same time reducing their dimension so that the image take most of ...
G M's user avatar
  • 22.8k
0 votes
1 answer
58 views

I have a code import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec def format_axes(fig): for i, ax in enumerate(fig.axes): ax.text(0.5, 0.5, "ax%d" % (i+1), va=&...
Andrey Romanov's user avatar
1 vote
2 answers
124 views

I'd like a plot that has two subplots in the first row, each spanning 1.5 columns, and three plots in the second row, each a column wide. Is that possible with matplotlib and gridspec? From the ...
K. Shores's user avatar
  • 1,033
1 vote
0 answers
63 views

How can I produce 1x15 subplots where the first and second columns are filled contour and the third column will have two stacked horizontal line plots in each of the rows? The code below is an example ...
Rocc's user avatar
  • 13
0 votes
1 answer
103 views

How can I produce 3x3 subplots where the first and second columns are filled contour and the third column will have two stacked horizontal line plots in each of the rows? This is the kind of layout (...
Rocc's user avatar
  • 13
1 vote
1 answer
307 views

I am trying to plot two subplots. One of them is a heatmap from seaborn library and other one is line plot from matplotlib. Line plot is showing gasoline prices through the 2022 and heatmap shows the ...
milikest's user avatar
1 vote
0 answers
706 views

I'm using gridspec to make a rather complicated figure layout. It works mostly fine without spacing adjustments, but some labels still overlap in the 4 subplots at top right: import matplotlib.pyplot ...
dax's user avatar
  • 55
2 votes
2 answers
103 views

I need to creat a single figure with some subplots. The figure must look exactly like below: I'm having a problem to plot the second graph, I don't know how to get a "zoom" from the other ...
Maria_'s user avatar
  • 31
0 votes
1 answer
339 views

I have a grid with 4 subplots and 2 overlaying subplots to create common xlabels between the first two and last two subplots (see code below). I get a slightly different spacing between the 2 subplots ...
Stef M's user avatar
  • 1
0 votes
0 answers
37 views

If you run the below code in ipython, you will find that the first window that pops up can be resized and the plots all adjust as usual. The second figure is created by trying to copy over the axis ...
MaanDoabeDa's user avatar
1 vote
1 answer
548 views

I want to add the colormap to show the gradient along x axis but unfortunately the whole figure turns black. I might be lacking something kindly help me in this. Here is the code. import matplotlib....
Prashant Priyadarshi's user avatar
0 votes
2 answers
319 views

I'm using matplotlib.gridspec to create a grid for 3 axes. My current code looks like: from matplotlib import pyplot as plt from matplotlib.gridspec import GridSpec import pandas as pd df = pd....
Loxx's user avatar
  • 111
0 votes
1 answer
177 views

I wanted to change the size of hspace on my figure without using constrained_layout=True. Here is my code: import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np ...
Mo0nKizz's user avatar
  • 322
0 votes
1 answer
284 views

I am trying to create a plot in matplotlib with three subplots in the first column and two in the second. Using gridspec, I have managed to tweak it, but somehow there are large spacing between the ...
Jes's user avatar
  • 130
1 vote
2 answers
509 views

I wanted to have a background for each subplot of my figure. In my example, I want the left side to be red and the right side to be blue. import matplotlib.pyplot as plt import numpy as np from ...
Mo0nKizz's user avatar
  • 322
1 vote
1 answer
315 views

I wanted to plot 2 imshow on a figure, but I only want the sub figure on the right to have the colorbar at the bottom of its plot. import matplotlib.pyplot as plt import numpy as np from matplotlib....
Mo0nKizz's user avatar
  • 322
2 votes
0 answers
217 views

I am trying to create a figure in pyplot with specific gridspec, but I got into a dead end. When using subfigures it is needed to use constrained_layout = True option in the figure definition, but it ...
Galedon's user avatar
  • 21
2 votes
1 answer
770 views

When using gridspecs, I find it difficult to align different nested gridspecs. I often use gridspecs for figures where most or all subplots have a fixed aspect ratio (e.g., to display images). A ...
delio's user avatar
  • 23
2 votes
1 answer
481 views

I have the following page layout with two charts up top, a map, and a table. As you can see in the result, the table title is not aligned with the Map title, and there is way too much space between ...
Ilya Voytov's user avatar
1 vote
1 answer
5k views

I have a matplotlib plot with 3x2 subplots. I want no spacing between the columns (achieved), and no spacing between the first (a, b) and the second row (c, d). However, the third row (e, f) should be ...
laolux's user avatar
  • 1,565
1 vote
1 answer
725 views

I am trying to create a figure with 2x10 subplots. I would like them all to be square with a thin white space in between them, but they are coming out as rectangles (longer in height than width). The ...
Lukas Fuentes's user avatar
2 votes
1 answer
746 views

I would like to use a for loop to iterate through to plot graphs of individual groups of gridspec plots. I define a gridspec to give me this plot: I wanted to do a for loop to repeat these plots in ...
Joe's user avatar
  • 405
1 vote
1 answer
2k views

I would like to create the following plot with Python in PyCharm: I am using the following code: import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec def format_axes(fig): for ...
ab3001's user avatar
  • 23
2 votes
1 answer
886 views

I would like to create a plot with a Cartopy plot on the left-hand side and two stacked Matplotlib plots on the right-hand side. If I'd only use Matplotlib plots, the code would be as follows. import ...
Stücke's user avatar
  • 1,023
1 vote
1 answer
282 views

How do I align the GridSpec to look like this? |‾ ‾ ‾ ‾| |‾ ‾| |‾ ‾| | | |_ _| |_ _| | | |‾ ‾| |‾ ‾| |_ _ _ _| |_ _| |_ _| I have tried the following: import matplotlib.pyplot as ...
Kevin's user avatar
  • 3,418
1 vote
2 answers
918 views

I am trying to make a figure with a grid of 12 plots on the left and one larger plot on the right. The problem is that matplotlib adds far too much space between the small subplots. How can I get rid ...
Onno Eberhard's user avatar
0 votes
1 answer
174 views

For some reason I couldn't find information on this (I'm pretty sure it exists somewhere), but in the following generic example, I would like to reduce the hspace between ax1 and ax2 while keeping the ...
Jannik Kühn's user avatar
0 votes
1 answer
878 views

I have a matplotlib gridspec plot as below: import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec fig2 = plt.figure(figsize=[8,8]) spec2 = gridspec.GridSpec(ncols=2, nrows=2, figure=...
Ailurophile's user avatar
  • 3,025
1 vote
1 answer
205 views

I'm trying to fix the format for this plot: that I'm generating with "Df" data, but I'm having this cumbersome issue in which both plots are too close. The script I'm using to plot this is: ...
nuwe's user avatar
  • 187
2 votes
1 answer
717 views

I want to plot several images side-by-side. These images all have the same height, but different widths. I want them all to line up neatly, so the figure looks professional. Instead, the narrower ...
CesiumLifeJacket's user avatar
0 votes
1 answer
792 views

I've been creating uneven subplots in matplotlib based on this question. The gridspec solution (third answer) worked a little better for me as it gives a bit more flexibility for the exact sizes of ...
Tobitobitobi's user avatar
4 votes
1 answer
2k views

I am trying to plot 6 plots in the form of a grid using gridspec. I want one color bar placed at the bottom between the 2nd and 3rd columns. My code is as follows, but it generates 6 colorbars. How ...
Dushi Fdz's user avatar
  • 171
1 vote
1 answer
355 views

I have a function that returns a fig, ax pair. However I want to put that result inside a subplot of my gridspec. fig, ax = draw_football_field(dimensions, size) # this is the output that I want to ...
vftw's user avatar
  • 1,697
2 votes
1 answer
6k views

Suppose I have 3 directories of .jpg files: dataset 1, dataset 2, dataset 3. I would like to make a 5 by 3 subplots using matplotlib. For each row, the subplot shows the data from dataset 1, dataset 2 ...
Big Face's user avatar
1 vote
1 answer
566 views

Given a gridspec object in matplotlib, I want to automatically iterate through all its indices so I can add the corresponding Axes automatically, something like: for i, j in gspec.indices: # whatever ...
irene's user avatar
  • 2,253
3 votes
2 answers
1k views

Suppose something comes up in my plot that mandates that I change the height ratio between two subplots that I've generated within my plot. I've tried changing GridSpec's height ratio to no avail. ...
Forklift17's user avatar
  • 2,547
1 vote
1 answer
295 views

I am using two GridSpec objects to generate the following plot: import numpy as np import matplotlib.pyplot as plt from matplotlib.figure import figaspect plt.rcParams.update({'figure.figsize' : (10,...
Luismi98's user avatar
  • 322
1 vote
2 answers
722 views

I am trying to attain a set of subplots that looks like the result for this code: import matplotlib.pyplot as plt import numpy as np import matplotlib.gridspec as gridspec fig = plt.figure(...
AoJol's user avatar
  • 17
1 vote
1 answer
207 views

I'm trying to use plt.GridSpec() to set up two subplots such that the left one takes up about 67% of the space and the right one takes up 33%. I looked at the documentation, but I just can't seem to ...
a11's user avatar
  • 3,476
3 votes
1 answer
3k views

I would like to create a summary A4 page for the results of some computations I have done. These include both images and plot in a layout like the one the code below produces. Unfortunately, ...
AlexNe's user avatar
  • 989
3 votes
2 answers
1k views

I am using matplotlib and GridSpec to plot 9 images in 3x3 subplots. fig = plt.figure(figsize=(30,40)) fig.patch.set_facecolor('white') gs1 = gridspec.GridSpec(3,3) gs1.update(wspace=0....
Jame's user avatar
  • 3,884