Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To alter the y-axis range in a plotly plot without affecting the size of markers, you need to adjust the size of the axis rather than the markers themselves. One way to do this is by setting the 'range' property of the y-axis using the 'layout' object.

Example code:

import plotly.express as px # create a scatter plot fig = px.scatter(df, x='x_column', y='y_column', size='size_column') # adjust the y-axis range fig.update_layout( yaxis=dict( range=[0, 10] # set the range to be from 0 to 10 ) ) # display the plot fig.show() 

In the above example code, 'df' is a pandas data frame containing the data to be plotted. The 'size_column' parameter is used to adjust the markers size. The 'yaxis' parameter is used to set the range of the y-axis. Note that this will not affect the size of the markers.