Skip to content

Extra space gets added below and above the chart #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
saimaparveen opened this issue Jun 9, 2017 · 11 comments
Closed

Extra space gets added below and above the chart #1775

saimaparveen opened this issue Jun 9, 2017 · 11 comments

Comments

@saimaparveen
Copy link

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

@etpinard
Copy link
Contributor

etpinard commented Jun 9, 2017

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
Copy link
Contributor

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

@saimaparveen
Copy link
Author

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 ?

@etpinard
Copy link
Contributor

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

@saimaparveen
Copy link
Author

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.

@etpinard
Copy link
Contributor

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.

@saimaparveen
Copy link
Author

saimaparveen commented Aug 24, 2017

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?

@SebastianB12
Copy link

@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

@etpinard
Copy link
Contributor

you can set the axis range.

@SB-SVM
Copy link

SB-SVM commented Jul 2, 2018

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

@alexcjohnson
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants