Questions tagged [twinx]
For questions about the matplotlib twinx method, which creates a new Axes with an invisible x-axis and an independent y-axis positioned opposite to the original one (i.e. at right).
twinx
89
questions
0
votes
0
answers
29
views
How to break y axis after using ax2.twinx()
I have created a plot with two y axis using ax2.twinx(). But now i want to break y axys according to a certain value to create two different sublots with an interval of value between them.
How to do ...
-1
votes
1
answer
128
views
Ordering plots so that twin axis plot is behind axis plot (matplotlib)
Im plotting graphs (nrows=2), p1 bars on top chart y-axis, p2 bars on bottom y axis, and a line/area chart on the twin yaxis (pidx on top and bottom).
I cant seem to get the twin axis plot (pidx) to ...
0
votes
1
answer
164
views
Matplotlib drawing labels from twin axis on top of label of original axis
I have a problem in that Im drawing a plot of 7 moving averages (p1, dataframe) using the left y-axis. On the right y-axis Im drawing the data the MAs are made from (pidx, also dataframe). Being time-...
0
votes
0
answers
32
views
How to add a third right axis data value to the mouse hover x, y values show in the bottom right of matplotlib charts? [duplicate]
How would you add a third right axis data value to the mouse hover x, y values show in the bottom right of matplotlib charts? The right axis was created using ax_right=ax.twinx(). I'd like the bottom ...
0
votes
0
answers
49
views
Distinguish matplotlib twinx axis for better visibility
When using twinx axis, it is sometimes difficult for the lecturer to distinguish one axis from the other, especially in black and white. I found a plot in an article using a symbol with a circle and ...
2
votes
1
answer
110
views
How to ensure there is an x and y margin when using twinx and twiny
I am trying to create a scatter plot like the desired image, but my code doesn't have space before 1 or after 7.
How can I fix the problem?
import numpy as np
import matplotlib.pyplot as plt
# Set ...
0
votes
0
answers
22
views
Imshow add secondary y-axis and keep format
I am trying to add a secondary y-axis to my imshow plot:
Original without secondary y axis
But it wont keep the original format, i.e. i want the secondary y-axis scaled the the same as my axis on the ...
0
votes
0
answers
32
views
Put Values in Combination plot [duplicate]
Using this example DataFrame:
d = {'date': ['202301', '202302', '202303', '202304', '202304'],
'amount': [190080.10, 200010.20, 201085.50, 202550.54, 212035.80],
'percent': [1.88, 1.89, 1.88,...
0
votes
1
answer
76
views
How do I make the shrinking/expanding to achieve aspect ratio behave consistently in with twinx/twiny?
When I add twinx and/or twiny axes with the python library matplotlib, the effect of a specified aspect ratio becomes inconsistent:
When I set an aspect ratio without twinx/twiny, the axes are zoomed ...
3
votes
2
answers
113
views
How to plot grouped bars overlaid with lines
I am trying to create a chart below created in excel based on the table below using matplotlib..
Category
%_total_dist_1
event_rate_%_1
%_total_dist_2
event_rate_%_2
00 (-inf, 0.25)
5.7
36.5
5.8
10
...
0
votes
2
answers
312
views
How to add legend when using twinx
I am trying to plot 2 values with same x axis values (time) but different y axis values. I am trying to add legend to the plot, however, I keep getting 2 legends for the same variable instead of one ...
0
votes
0
answers
24
views
How to scale yleft and y right axis using twinx?
I need to scale the left or right y-axis in order to have just one data point in the chart for each set of data.
This means that, I want the following solution:
on the left y-axis 56 corresponds to 10....
0
votes
0
answers
24
views
How to plot dual y-axes with no offset
I have a script that reads a database and retrieves timstamps and two values for each timestamp (level and altitude) here:
dbc = r'Database Connection'
QueryTable = "QueryTable"
...
2
votes
1
answer
191
views
twinx or twinx-like supylabel for matplotlib subplots?
Given the subplots setup shown below, is there any possibility to add a super y label at the right side of the plot analogously to the 'Green label'?
import matplotlib.pyplot as plt
fig, axs = plt....
1
vote
1
answer
192
views
tick_params doesn't work properly for 2nd y-axis
I am designing a GUI in which whenever I click a button, the figure inside the GUI will be updated. This figure contains two y-axes with a common x-axis. I am using twinx function inside matplotlib. ...