plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Extra space gets added below and above the chart

Open saimaparveen opened this issue 9 years ago • 11 comments

Hi,

Extra space is added at the top and bottom of chart if chart height is more. Any idea how to remove it? screen shot 2017-06-09 at 9 56 22 pm

https://codepen.io/saimaparveen/pen/mwVLLL

saimaparveen avatar Jun 09 '17 16:06 saimaparveen

Assuming you're referring to the space between y=0 and y='test', you can try tweaking yaxis.range to fit your needs: https://codepen.io/etpinard/pen/qjbYgX?editors=0010

etpinard avatar Jun 09 '17 16:06 etpinard

Closing. @saimaparveen if you have any other questions on this topic, please use https://community.plot.ly/

etpinard avatar Jun 12 '17 14:06 etpinard

Hi,

yaxis: { range: [-0.5, trace1.y.length-3] }

This solution works only for static data .. for me the graph data is changing that is why this solution is not working .. If data is more trace1.y.length-3 still leave space on top. Is there any way i can know what value we can minus from trace1.y.length ?

saimaparveen avatar Jun 14 '17 09:06 saimaparveen

for me the graph data is changing

How are you updating your data? You can use Plotly.relayout or Plotly.update to update the yaxis range dynamically to fit your needs

etpinard avatar Jun 14 '17 12:06 etpinard

The issue is not with the update. The issue is occurring when there is duplicate data for y axis or xaxis for ex: the code which is attached above is having 2 duplicate values in categories "ss" ,"rr"
We are doing trace1.y.length-3 which is removing space on top, when there are no duplicates then there is no extra space at top.

saimaparveen avatar Jun 16 '17 10:06 saimaparveen

the code which is attached above is having 2 duplicate values in categories "ss" ,"rr"

Hmm. I doubt that's the case.

The markers mode add some padding to the autoranged axes. This logic is slightly opinionated, and you're not the first one complaining about it not giving the desired results. As I mentioned above, to override this behavior, you can set the axis range.

etpinard avatar Jun 16 '17 14:06 etpinard

Same issue is happening for space in left and right side. When the mode is "markers+lines" when the mode is just "lines" it is working fine. screen shot 2017-08-24 at 1 25 04 pm

https://codepen.io/anon/pen/brjGJV

Any idea how this can be fixed?

saimaparveen avatar Aug 24 '17 08:08 saimaparveen

@saimaparveen : I have the same issue (white space on the left and right side) in the "lines+text" mode. Did you solve the issue somehow? "lines+text" mode: image

"lines" mode: image

SebastianB12 avatar Jun 29 '18 14:06 SebastianB12

you can set the axis range.

etpinard avatar Jun 29 '18 14:06 etpinard

I already set the axis range. However, if I press "All" on the rangeselector, it is showing me the white spaces again. Before using the rangeselector:

before

After clicking the "all" button: after

SB-SVM avatar Jul 02 '18 16:07 SB-SVM

FYI making this whole situation more configurable is being discussed in #1876. That effort, whenever it happens, will include the ability to override this automatic padding.

alexcjohnson avatar Jul 02 '18 17:07 alexcjohnson