2,033 questions
3
votes
1
answer
41
views
Julia suplot with gr() widths not uniform
Julia 1.11.7 (Also tried in 1.10.1) on Linux.
Plots v1.41.1
using Plots; gr()
titles = hcat(["X "*string(x) for x in collect(15:-1:8)'], ["X "*string(x) for x in collect(0:7)'])
...
0
votes
1
answer
55
views
How to Remove Unused Space Below Text in a Matplotlib Subplot
I have the following code snippet, which produces 3 subplots:
2 on the same row side by side, for the logo and title
1 below that will include various texts.
# ---- RIGHT COLUMN: 6 rows ----
...
0
votes
1
answer
150
views
how can I access particular y and x axis using ax = fig.add_subplot(3, 3, i +1), for a loop on i?
It seems accessing axis is easy with
fig, ((ax1, ax2,ax3,ax4)) = plt.subplots(2, 4,figsize=(10,8),layout='tight')
subfigs = fig.subfigures(2, 4)
For example, if I want the ticks (labeling too) on the ...
2
votes
1
answer
171
views
How to reclaim horizontal space made available by removing labels and ticks?
I have a row of subplots which start with a histogram and the rest are some qqplots:
I removed the y axis and ticks labels using
for ax in axqq[1:]:
ax.set_ylabel(None)
ax....
1
vote
1
answer
155
views
Subplot spacing with scaleanchor and constrain in plotly
I am trying to create a figure with three subplots. The bottom left subplot is supposed to be a 2D histogram with projections on the top and right sides.
The 2D histogram is supposed to be square (...
2
votes
2
answers
82
views
Subplots of different heights in matplotlib?
I would like to create three figures showing how a quantity varies with z in three different simulations. The different simulations have different domains, the first extends from z=0 to 1.4, the next ...
0
votes
1
answer
71
views
Matplotlib figure with 2 animation subplots: how to update both [closed]
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
106
views
Aligning matplotlib subplots one with stacked bar plot and another with line plot using matplotlib in Python [duplicate]
I have 2 dataframes as follows:
df1.to_dict() results in
{'Peak Demand PES': {2023: 124126.91,
2025: 154803.41,
2030: 231494.66,
2040: 483217.66000000003,
2050: 1004207.86},
'Peak Demand TES':...
0
votes
2
answers
62
views
Plot with 8 subplots where 4x4 with horizontal space
I am trying to make a plot where I just want some distance between the first and second set of plots. Basically when you plot below, you can see the y-axis values off ax5 and ax7 there that is where I ...
0
votes
1
answer
136
views
How to use the same colour map and scale for two different graphs plotted together (using custom colormap)
I have 3 data sets: height, data1 and data2, where all are different and I want to plot height vs data1 and height vs data2 as a (1,2) subplot using pcolormesh and have them share a colorbar.
The ...
1
vote
1
answer
59
views
To plot variable number of plots with variable number of graphs from Pandas grouped by some columns
I've been dealing with Python for the last few months and it still a little bit irritate me :)
But hope someone can explain how to plot some subplots from dataframe grouped by 2 columns using ...
0
votes
2
answers
126
views
Align yaxis label spanning two axes with yaxis labels of one axes in subplots
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 ...
0
votes
1
answer
50
views
How do I create a secondary axis based on on a complex conversion?
I am trying to create a secondary axis for my plot. I can get all of my lines to plot on the graph (y1 to y14) and all y values are in the same units. The conversion to a secondary unit is essentially ...
0
votes
1
answer
59
views
How to superimpose the rotated subplot on the another sublot?
I would like to release such configuration of plots as it presented on the picture:
The next parameters have to be variable:
Position of subplot origin point
Rotation angle of subplot
Size of ...
0
votes
1
answer
44
views
Annotate each subplot from a list
I have a large dataframe that I need to make and annotate subplots from, see below. Everything seems ok, I still have some work to do on the x and y ticks but otherwise it seems pretty right, except, ...
0
votes
1
answer
48
views
Matplotlib - Fix bar chart, using subplots, and inserting labels per each bar
I am creating a bar chart with the following code. I am getting the text I need but the format is incorrect, due is overlap with the titles and part of the first subplot. Could you please tell me how ...
0
votes
1
answer
37
views
Move Span center to click position not showing range when clicking in subplot with shown range
I have created a 2 plot subplot. Selecting the range in both subplots works fine. Clicking into the upper subplot (the zoomed plot) shifts both views fine, but when clicking in the lower (total view) ...
2
votes
1
answer
50
views
How to increase the space between the subplots and the figure?
I'm using a python code to plot 3D surface. However, the z-axis label get cut by the figure. Here is the code :
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(12, 10), ...
0
votes
1
answer
147
views
How to create single column 3x1 plot in a 3x2 subplot?
I want to create a plot with 2 columns, with the 1st one has only 1 plot and the 2nd one has 3. I try to set it up by using the following code
import matplotlib.pyplot as plt
def format_axes(fig):
...
0
votes
1
answer
59
views
Plotly: How to make subplots with multiple traces
I am plotting two figures in Plotly using this code:
d = {'1': pd.DataFrame({'x': [1,2,3], 'y': [2,4,6]}), '2': pd.DataFrame({'x': [2,4,6], 'y': [4,6,8]})}
def p1(df, n):
x = df.x.tolist()
y = ...
0
votes
0
answers
66
views
Plotting Central Tendencies (Mean, Median, Mode) into Seaborn Subplots
I Have an error when I try to run this code
import pandas as pd
import numpy as np
import seaborn as sns
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib.cm import ScalarMappable
...
0
votes
1
answer
80
views
Set suptitle and y-ticks in subplot
I have two different functions, each producing a plot.
list_soal = ['SalePrice', 'GrLivArea', 'GarageArea']
# fig,ax = plt.subplots(1, 3, sharey=True, figsize=(14,4))
def function1(ax):
for i in ...
0
votes
1
answer
88
views
How to save a subplot in for loop?
Using this code to create and save a subplot automatically (in a for loop) is not working and throwing up an error I don't understand:
clear
clc
close all
%----------------------------
x1 = 1:0.01:3;
...
1
vote
1
answer
127
views
How to scale subplots including images with different aspect ratios?
A minimal version of my problem is the following plot. How do I scale the right panel to have the same height as the left one?
import matplotlib.pyplot as plt
import numpy as np
rnd = np.random....
0
votes
2
answers
107
views
How can I prevent Matplotlib from autoscaling images to the same size in subplots?
I’m trying to display three images of different sizes side-by-side using Matplotlib. I want each subplot to maintain the original size of the images without auto scaling them to be the same size.
...
3
votes
1
answer
60
views
Plotting differently sized subplots in pyplot
I want to plot a figure in pyplot that has 3 subplots, arranged vertically. The aspect ratios of the first one is 1:1, while for the other two it is 2:1. And the heights of each of these plots should ...
1
vote
1
answer
64
views
How to plot dataframe as a table along side a graph?
Hi i have a dataframe called metrics which has 2 rows × 31 columns.
I am plotting a graph using this:
unit_ids = sorting_rec.unit_ids
plt.figure(figsize=(12, 8))
sw.plot_unit_templates(we, unit_ids=...
0
votes
1
answer
95
views
Setting the legend on top of the lines connecting mark_inset plot
I'm using InsetPosition and mark_inset to make a subplot so that I have the lines connecting them. However, I can't get the lines to be on top of the legend in the first plot. Any thoughts on how I ...
0
votes
0
answers
87
views
Update spacing between Plotly subplots
Is there a way to change the vertical/horizontal spacing between subplots in an existing figure?
I couldn't find anything in the docs or user forum, and the following throws a Bad property error:
...
0
votes
1
answer
49
views
Setting the same axis limits for all *unpacked* subplots
What is an efficient way to assign the same specs (for example, xlim) to matplotlib unpacked subplots?
I have
fig, (axs1, axs2,axs3) = plt.subplots(3, sharex=True, figsize=(10,6), gridspec_kw={'...
0
votes
1
answer
42
views
Populate Subplots by looping through time
I am creating a 6 panel subplot with each plot showing a different time step for my data. I am having trouble creating a loop that plots each time into one of the panels. I have been able to produce ...
1
vote
0
answers
94
views
How to automate placement of fig.suptitle properly when displaying wide images with imshow in matplotlib?
The issue is that fig.suptitle and ax.imshow (with wide images) do not work well together. I understand that there are some aspect ratio (or something) hurdles to overcome due to the image being wide ...
0
votes
1
answer
78
views
R: Combine subplots into one organism using ggplot and plotly
I have a lot of data with categorical variables that has a lot of levels. This gives me some difficulty plotting them, especially when I put them into Rmarkdown. I am trying to figure out how to best ...
1
vote
0
answers
165
views
How to break multiple y axis in matplotlib subplots
I have two dataframes from which I want to create a figure with two plots. The first corresponds to the daily temperature and the average temperature for each month. The second subplot shows the width ...
2
votes
2
answers
84
views
Tight subplot axes without their plot to the figure
I have made a subplot in matplotlib and managed to to put the different cmap I have on the same column. For a minimal working example (with dummy cmaps):
import matplotlib.pyplot as plt
import numpy ...
0
votes
1
answer
44
views
How to place 2 graphs with subplots side by side in Python?
I would like to plot positive and negative word charts for each category together on the same grid. To achieve that, I'm using plt.subplot(). I'm using for loop to plot graphs for all the categories. ...
1
vote
0
answers
52
views
Unexpected behaviour in seaborn subplots when the x axis is being shared [duplicate]
I am having trouble using the sharex=True when I create two graphs with seaborn that should share the same horizontal axis.
I have my example hereafter and even with sharex=False I get a warning that ...
0
votes
0
answers
71
views
Plotting problems in python script vs jupyter notebook
I am encountering issues with my plotting code when running it as a Python script in PyCharm. The plots overlap, and the legends are not displayed, which does not happen when I run the same code in a ...
1
vote
1
answer
617
views
SHAP Waterfall diagram as a matplotlib subplot?
Hi i would like to Show side by side diagrams from SHAP Library:
Waterfall Diagram :API Reference https://shap.readthedocs.io/en/latest/generated/shap.plots.waterfall.html#shap.plots.waterfall
Bar ...
1
vote
0
answers
22
views
fig.add_axes() Subplot normalized coordinates do not match
I want to have a master plot, and various subplots that will be plotted at specific locations on the master plot coordinate system. The y coordinates should be matching and the x of the subplots is ...
1
vote
1
answer
55
views
Interactive checkboxes (or buttons) in subplots Matplotlib figure in QGraphicsView PyQt5
I'm trying to optimize example (https://matplotlib.org/stable/gallery/widgets/check_buttons.html) for my task in a small project.
I have an example that works:
from PyQt5.QtWidgets import QApplication
...
1
vote
1
answer
53
views
Unexpected result with function to plot subplotting
I create the next function to plotting barplotd and I want to use this function to make subplots, but when I try it I don't get the result I expect:
import numpy as np
import pandas as pd
import ...
0
votes
0
answers
37
views
Adding padding within a subplot
Can someone tell me what I need to do to change the padding within the boundary of a subplot in Julia? Just need to know how to make the border larger so the 8 doesn't overlap for example in this mwe:
...
0
votes
0
answers
56
views
Handle multiple subplots distributed unequally which share x value
This is the first question I am writing, sorry if something is not correct.
I'am trying to plot several subplots in same figure:
They can't be plotted in a squared grid because each row rapresent a ...
-2
votes
2
answers
67
views
How to show percentage in each plot? [closed]
When trying to plot the following code I got 4 graphs but the percentage shows in only in the last graph.
fig, axes =plt.subplots(12,2,figsize=(12,50))
plt.subplots_adjust(wspace=0.9, hspace=0.9)
i=0
...
1
vote
2
answers
546
views
How do I link zooming on multiple plots of the same dataframe with different axis ranges?
I am making multiple plots based on the same data source, the markers on each plot represent the same set of samples. If my data is in a table or dataframe, the different plots may use different ...
2
votes
1
answer
523
views
Remove gaps between subplots_mosaic in matplotlib
How do I remove the gaps between the subplots on a mosaic? The traditional way does not work with mosaics:
plt.subplots_adjust(wspace=0, hspace=0)
I also tried using gridspec_kw, but no luck.
import ...
0
votes
0
answers
59
views
Plotly stacked bar chart in subplot -- visually differentiate the "stacked" values inside the subplot
Assume we're using the plotly px.data.iris() dataset to generate a stacked bar chart. This is pretty straight-forward using plotly express:
import plotly.express as px
df = px.data.iris()
df = df[[&...
0
votes
1
answer
1k
views
How to change the size and spacing of Plotly's sublopts?
How is it possible to manipulate the spacing between rows(e.g. increasing the space between fist two rows and final two rows) and the size of charts inside the figure (e.g. making pie chart bigger)?
...
1
vote
1
answer
365
views
Combining Plotly and ggplot2 charts with Patchwork in one Facet
I want to combine two charts prepared with Plotly and ggplot2 into one PDF. Below, you can see the code for the preparation of the charts:
library(ggplot2)
library(plotly)
library(dplyr)
library(...