multiple-axes

plot dataframe with two y-axes

ⅰ亾dé卋堺 提交于 2021-02-20 06:16:57
问题 I have the following dataframe: land_cover 1 2 3 4 5 6 size 0 20 19.558872 6.856950 3.882243 1.743048 1.361306 1.026382 16.520265 1 30 9.499454 3.513521 1.849498 0.836386 0.659660 0.442690 8.652517 2 40 10.173790 3.123167 1.677257 0.860317 0.762718 0.560290 11.925280 3 50 10.098777 1.564575 1.280729 0.894287 0.884028 0.887448 12.647710 4 60 6.166109 1.588687 0.667839 0.230659 0.143044 0.070628 2.160922 5 110 17.846565 3.884678 2.202129 1.040551 0.843709 0.673298 30.406541 I want to plot the

plot dataframe with two y-axes

懵懂的女人 提交于 2021-02-20 06:16:18
问题 I have the following dataframe: land_cover 1 2 3 4 5 6 size 0 20 19.558872 6.856950 3.882243 1.743048 1.361306 1.026382 16.520265 1 30 9.499454 3.513521 1.849498 0.836386 0.659660 0.442690 8.652517 2 40 10.173790 3.123167 1.677257 0.860317 0.762718 0.560290 11.925280 3 50 10.098777 1.564575 1.280729 0.894287 0.884028 0.887448 12.647710 4 60 6.166109 1.588687 0.667839 0.230659 0.143044 0.070628 2.160922 5 110 17.846565 3.884678 2.202129 1.040551 0.843709 0.673298 30.406541 I want to plot the

Bring axes to front without redrawing the figure?

不羁岁月 提交于 2021-02-18 12:10:45
问题 Is there a way in Matlab to bring an axes to front without having Matlab perform a redraw ( drawnow ) implicitly? Background to my question: I am preparing a large figure with several subplots. In some of them I have 2 axes superposed, because I want to see the same data on 2 different y-scales. After playing around with axes settings, I finally got the figure to look like I expected. But: I need to bring one of the axes to front (in my case, the left axes hAxL). So I have this line in my

Matplotlib: different scale on negative side of the axis

人盡茶涼 提交于 2021-02-11 06:53:23
问题 Background I am trying to show three variables on a single plot. I have connected the three points using lines of different colours based on some other variables. This is shown here Problem What I want to do is to have a different scale on the negative x-axis. This would help me in providing positive x_ticks, different axis label and also clear and uncluttered representation of the lines on left side of the image Question How to have a different positive x-axis starting from 0 towards

R multiple y axis interactive plot

谁说胖子不能爱 提交于 2021-02-08 09:47:07
问题 I am trying to create a plot in R similar to this: with up to 6 variables and it has to be reactive. I tried plotly, however in plotly I would get axis ticks on the plot, and it gets messy, and I managed to get only one y axis out. Is there a way to recreate the plot in plotly or any other interactive library? My plotly code: library(dplyr) library(plotly) library(tidyr) data <- cbind( seq(from = 1, to = 30, by = 1), sample(seq(from = 100, to = 300, by = 10), size = 30, replace = TRUE),

Prevent grid lines from twin axis to be drawn on top of artists from original axis

可紊 提交于 2021-02-08 06:54:45
问题 I have an axis on which I plot some data and I have another twin axis which I use to draw grid lines at specific tick positions (other than the ticks of the original axis): import matplotlib.pyplot as plt import numpy as np f, ax = plt.subplots() ax.set_xlim([0, 1]) ax2 = ax.twiny() ax2.set_xlim([0, 1]) ax2.set_xticks(np.linspace(0, 1, 11)) ax2.xaxis.grid() x = np.linspace(0, 1, 100) ax.plot(x, np.sin(x), label='sin(x)') ax.legend() plt.show() Now this has the undesirable effect that the grid

How do I plot points with two different y-axis ranges on the same panel in the same X axis?

霸气de小男生 提交于 2020-01-13 19:19:24
问题 I am trying to create a scatterplot using ggplot that shares an X axis but has a Y axis with two different scales. The bottom of the Y axis has three scales from 0% to 0.1%, then 0.1% to 1%, and then finally regular intervals by 10%. An example from here: Is there a way to produce something like this in R using ggplot? Would I be modifying the axes? Overlaying several plots on the same panel? Or something else? 回答1: Generally discontinuous axes are not recommended within ggplot2, for reasons

Matplotlib: add twin y axis without using its values in the plots

做~自己de王妃 提交于 2020-01-02 13:32:07
问题 This is to clarify the question title. Say you have four lists of integers, with which you want to produce a scatter plot: a=[3,7,2,8,12,17] b=[9,4,11,7,6,3] c=[9,3,17,13,10,5] d=[5,1,1,14,5,8] You also have a function, for simplicity f(x)=1/x , that applies to all lists, so that: from __future__ import division a1=[1/i for i in a] b1=[1/i for i in b] c1=[1/i for i in c] d1=[1/i for i in d] My question: how to add a second y axis, knowing that the values returned by the function range from 0

Plotly: Grouped Bar Chart with multiple axes

巧了我就是萌 提交于 2020-01-02 01:07:56
问题 When I set barmode='group' in Layout while trace2 = Bar(...,yaxis='y2') , this leads bars to be stacked or overlayed instead of grouping them. How can I group the bars while having multiple axes? I went over these but no avail: With single Y axis grouped bar chart is shown here. Multiple axes is also explained here and reference for y-axis is available here 回答1: Here's an example of a grouped bar charts with multiple axes: https://plot.ly/~etpinard/2080/grouped-bars-on-multiple-axes/ The

Unable to control scale of second y-axis on df.plot()

烂漫一生 提交于 2019-12-24 12:04:09
问题 I am trying to plot 3 series with 2 on the left y-axis and 1 on the right using secondary_y , but it’s not clear to me how to define the right y-axis scale as I did on the left with ylim=() . I have seen this post: Interact directly with axes … but once I have: import matplotlib.pyplot as plt df = pd.DataFrame(np.random.randn(10,3)) fig, ax1 = plt.subplots() ax2 = ax1.twinx() ax1.plot(df.index,df.iloc[:,[0,2]]) ax2.plot(df.index, df.iloc[:,2]) plt.show() doesn't produce anything at all. I am