question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting only min or max values for axis and not a range.

See original GitHub issue

Dear all

Many thanks for all your wonderful efforts with Plotly

I just wanted to ask if it might be possible to tweak the range function a little

currently an axis range can be set in the layout like this …

layout = go.Layout(
xaxis=dict(
range=[2, 5]
),

in some cases it would be desirable to only specify a min value. Plotly can then work out the max value automatically.

Or perhaps a user would want to set a max value and have a plotly work out the min value

Either-way it would be nice (for me at least) to only specify one of the range limits and not both. However I can see why this might not be a highly required function and I’m sure there are lots of other things to do first

matplotlib offers this function …

plt.xlim(2,5) #sets a range
plt.gca().set_xlim(xmin=2) # sets only the lower x value and allows computer to work out upper value
plt.gca().set_ylim(ymax=50) # sets only the lower y value and allows computer to work out upper value

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:85
  • Comments:26 (6 by maintainers)

github_iconTop GitHub Comments

12reactions
dylanhensoncommented, Jun 25, 2019

Found the solution for setting the x or y axis’s minimum value to zero. Add the following to the layout() object: yaxis = list(rangemode = 'tozero') or xaxis = list(rangemode = 'tozero')

10reactions
ievgennaidacommented, Mar 24, 2022

Same request to set axes separately from python backend

https://github.com/plotly/plotly.py/issues/3634

Proposal is to allow pass None if value should be automatically determined: range=[2, None]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change the scale of the vertical (value) axis in a chart
In the Format Axis dialog box, click Scale, and under Value axis scale, modify any of the following options: To change the number...
Read more >
Show only min and max values on x-axis in column chart
Right click the chart and choose Select Data. In the x-axis label range, choose C1:10. Because you only have values on the first...
Read more >
How to set max and min value for Y axis - chart.js
As you can see max value (130) and min value (60) for Y axis are chosen automatically , I want max value =...
Read more >
How to set chart axis based on a cell value - Excel Off The Grid
The chart axis min and max settings are fixed values. This posts looks at a automated method to set chart axis based on...
Read more >
Setting X axis min and max values outside of data range
I have a query which returns a DataTable with two columns, a Date and a Value. It only returns a row if there's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found