2,032 questions
0
votes
0
answers
17
views
Python->Subplot-> 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
29
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
44
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
0
answers
25
views
Python Script in Power BI: '{subplot_type}' at grid position ({row}, {col}) was not created with the secondary_y spec property set to True
Basically I am running Python script in Power Bi, I am very much new to Python. I installed Python correctly, with the correct libraries, copied code from this guy : https://github.com/BitcoinRaven/...
0
votes
1
answer
28
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
37
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
47
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
0
answers
31
views
Plotting FacetGrid
I have this Dataframe:
OverallQual Foundation
8 PConc
8 PConc
8 PConc
8 PConc
8 PConc
8 PConc
8 ...
0
votes
1
answer
80
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
113
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
83
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
48
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
38
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
25
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
44
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
45
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
38
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 ...
0
votes
0
answers
71
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
48
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
136
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
68
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
0
answers
21
views
Multirow subplots with numpy arrays, AttributeError: 'numpy.ndarray' object has no attribute 'hist' [duplicate]
I've been attempting to create a 2-by-2 grid of plots using matplotlib. My data are numpy arrays, and I am trying to create histograms of the data. However, when I format subplots to output two rows, ...
0
votes
1
answer
37
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
31
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
68
views
How to align subplots (in a plot grid) for some specified values with a simple plot in Matplotlib?
Signals are recorded for many temperatures and at some temperatures (that are evenly spaced), more complex experiments are performed with another varying parameter.
This is a simple simulated example.
...
0
votes
0
answers
60
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
268
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
16
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
39
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
43
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
18
views
Adding Error Bars to Multi-Panel Multiline Plot Using Matplotlib
I made a panel of 4 line plots, each plot contains multiple lines.
I am trying to add error bars to each line in the plot and I can't seem to make it work.
x is of dimension (23,)
y is of dimension (...
0
votes
0
answers
34
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
46
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 ...
0
votes
0
answers
24
views
how to transform a line chart into a bar chart while using plt.subplots()
I'm having some issues trying to transform 4 charts into a singular figure. I have 2 line charts and 2 bar charts , the problem is that whenever use the subplot method my bar charts turn into line ...
0
votes
0
answers
14
views
Why matplotlib extends figure size when using `fig.add_axes` in jupyter?
I'm using matplotlib (v 3.8.0) in jupyter (lab). I have a subplot of fixed size:
fig, axs = plt.subplots(1,3, figsize=(8,4))
resulting in the following panels.
So far so good. But if I use fig....
0
votes
0
answers
32
views
Adding subplot titles using plotly and annotations doesn't work
From this post it became clear that to add titles to each subplot using plotly the annotations in layout argument should be used. However in my case it doesn't seem to work, why not?
Reproducible ...
-2
votes
2
answers
61
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
254
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
168
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
43
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
761
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
221
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(...
0
votes
0
answers
428
views
__init__() got an unexpected keyword argument 'layout'
I am trying to run the code which is one of example on matplotlib and I didnt change anything. BUt it gives me an error:"init() got an unexpected keyword argument 'layout'"
CODE:
import ...
-4
votes
1
answer
75
views
Group by a dataframe and iterate over subplots for each group [closed]
I have a dataframe. I want to (in step 1) grouped it by column 'Main' (to create df_M1 and df_M2 and make a subplots for each created df). In (step 2), grouped each df (df_M1 and df_M2) by column 'Sub'...
1
vote
1
answer
200
views
buttons for subplots using plotly
I'm new to Plotly and I'm trying to have buttons for each subplot and not the figure. I'm not able to find the way to do it or find the way for it.
Can anyone please help me how can I do it ?
Here is ...
0
votes
1
answer
26
views
Removing one of the xticks or xticklabels from a 2x1 subplot
I am making a GUI which shows a graph of 4 different readings. Right now the readings are randomly generated. I am using matplotlib and animation to show live readings, where 2 of the readings are ...
1
vote
3
answers
187
views
Insert pie charts into bar chart
Assume I have the following bar chart made with library(plotly) (the space on the right side is intentional):
library(dplyr)
library(plotly)
library(tidyr)
d <- tibble(cat = LETTERS[1:3],
...
1
vote
0
answers
20
views
creat a subplot [2,2]
I'm trying to create a subplot of shape [2,2] with a pandas dataframe already created, but can´t find a solution.
Let's say I want the first plot inside one of the four plots. I feel I'm almost there, ...
0
votes
0
answers
22
views
Synchronize subplot size
I can make figures the same size by setting figsize when calling subplots, but how would I make subplots the same size and letting figure size change to make room?
import matplotlib.pyplot as plt
...
0
votes
0
answers
29
views
Aligning subplots in pyplot when using line plots over a boxplot [duplicate]
I'm trying to overlay subplots for specific rows in my dataframe as line plots onto a box and whisker plot of the same data.
I'm trying to illustrate that my outliers come from two specific rows, ...