Changing scale type on existing figure
See original GitHub issueI’m building a multipurpose dashboard that should be able to graph a wide variety of data with different settings. One of the requirements is being able to graph against milliseconds while another is to graph against datetimes. I currently have code similar to the following:
x_sc = DateScale()
y_sc = LinearScale()
ax_x = Axis(label='time', scale=x_sc, grid_lines='solid', tick_format='%m/%d/%y', tick_rotate=90)
ax_y = Axis(label='y_val', scale=y_sc, orientation='vertical', tick_format='0.2f')
pz = PanZoom(scales={'x': [x_sc], 'y': [y_sc]})
data = Lines(x=x_data, y=y_data, scales={'x': x_sc, 'y': y_sc})
zoom_interacts = widgets.ToggleButtons(options=OrderedDict([
(' ', None),
('xy ', pz)]),
icons = ["stop", "arrows"]
)
fig = Figure(axes=[ax_x, ax_y], marks=[data])
link((zoom_interacts, 'value'), (fig, 'interaction'))
widgets.HBox([fig, zoom_interacts])
swap = widgets.Select(
options=['dates', 'ms'],
description='Swap',
disabled=False
)
def swapAxes(b):
global x_data
global ax_x
global data
global fig
if(b == 'dates'):
ax_x.scale = DateScale()
x_data = date_data
else:
ax_x.scale = LinearScale()
x_data = ms_data
interactive(swapAxes, b=swap)
where y_data
, date_data
, and ms_data
are all numpy arrays. When the figure first renders it works as long as I’m using ms_data
with a linear scale or date_data
with a date scale. But when I try to change the scale using the select the values on the x_axis simply disappear. Is there a way to change this scale back and forth between a date scale and a linear scale?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
Change axis values of an already existing figure - MathWorks
I have a figure that has axis already and numbers in them. I wish to change the axis values display values so that...
Read more >Changing plot scale by a factor in matplotlib - Stack Overflow
As you have noticed, xscale and yscale does not support a simple linear re-scaling (unfortunately). As an alternative to Hooked's answer, ...
Read more >Change the scale of the horizontal (category) axis in a chart
To reverse the order of categories, expand Axis Options, and then select the Categories in reverse order check box. · To change the...
Read more >How to Add Remove and Change Scale Factors - YouTube
AutoCAD Productivity Training Webinar Available Now: https://gumroad.com/l/oPLLa ** Sign up for Updates and Free Downloads: ...
Read more >How to scale objects without changing dimensions - YouTube
To scale an object, simply type in the command line SCALE and select the objects you want to scale. You can select dimensions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That worked great! Thank you so much for the help!