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).

70 questions
0
votes
1 answer

Seaborn plot with multiple subplots and multiple y axis for each one

When plotting with twinx how can multiple subplots be used? %pylab inline import pandas as pd import seaborn as sns; sns.set() df = pd.DataFrame({'dt':['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04'], 'category':['a', 'b', 'a', 'b'],…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
0
votes
1 answer

Rotate x-axis ticks with twinx plot

I'm trying to rotate the x-axis labels by 90 degrees, which typically works with the last line of the category_amts() function below. However, because this is a dual-axis visual, the approach is not working. How do you rotate axis labels on a…
bshelt141
  • 1,183
  • 15
  • 31
0
votes
0 answers

Matplotlib how to collapse time gaps in datetime axis without changing axis from datetime to string?

I'm writing a stock trading application, and I want to show a chart with price data and multiple technical indicators plotted on the same graph. I'm using the twinx() function for plotting multiple indicators along with price. I don't know how to…
nparabz
  • 143
  • 1
  • 2
  • 12
0
votes
1 answer

How to format minor ticks on twin x- and y- axes, both of which are logarithmically scaled?

I have data for which I would like to show two different scales. Matplotlib docs (such as this one) contain a few examples that twin either the x or y axes (not both), and none of these examples show how to manipulate the minor ticks of both x and y…
user10121139
0
votes
1 answer

Plotting two plots. One with two series (and two scales), the other with 2 series on the same scales

I am plotting some data. One plot below the other. The top plot has two series with shared x-axis but different scales on the y-axis. The bottom plot has two series with the same x and y axis scales. Here is an image of when I wish to produce:…
Allentro
  • 406
  • 2
  • 13
0
votes
2 answers

matplotlib: tight_layout with more than 4 twinx axes has extra padding

I am running a script to plot a set of up to 6 curves sharing a common timeline. I am using twinx() up to 5 times and getting up to 4 detached axes on the right side of the plot. The script (shown below) is derived from this example. However, the…
LMNCA
  • 21
  • 6
0
votes
0 answers

Lineplot ticks missing from x axis

I'm trying to plot two data frames in one graph with 30 days data on the x axis. However most of the xaxis ticks are not showing and their spacing is off. How can I show the full 30 ticks? Here is the code: fig = plt.figure(figsize=(10,8)) g1 =…
ReinForce
  • 101
  • 2
  • 6
  • 11
0
votes
1 answer

How to plot pandas dataframe in same figure without destroying their actual orientation?

I was trying to do a comparison of runtime between Naive matrix multiplication and Strassen's. For this, I was recording the runtime for a different dimension of the matrices. Then I was trying to plot the result in the same graph for the…
sphoenix
  • 3,327
  • 5
  • 22
  • 40
-1
votes
1 answer

How to offset twinx y-axis by specified amount?

I am familiar to using twinx() to share an axis's x-axis with another subplot: fig, ax1 = plt.subplots() ax2 = ax1.twinx() ax1.plot(xdata1, ydata1) ax2.plot(xdata2, ydata2) This makes the y=0 axis line up between ax1 and ax2, but the axes are still…
PGmath
  • 381
  • 3
  • 16
-1
votes
1 answer

Plotting graph and adding twinx() with seaborn

I am plotting a graph using seaborn, the code is: fig, ax = plt.subplots(figsize=(20, 10)) ax2 = ax.twinx() sns.barplot(x="dt_mvtc", y="qtde_t0", …
Dimitri
  • 109
  • 1
  • 14
1 2 3 4
5