Can I scale my data independently in ploteditor (or similar) once the plot has been produced, i.e not programatically

I would like to make a GUI where you can look at your plots in real time, then output a figure of the plot you see, then edit the data in the plot within the plot itself. a simple example might be scaling
So as an example there could be an edit field for speed, and max distance:
speed=10 (m/s)
max_distance = 100 (m)
Then press the plot button which would give time (x) and distance (y)
y=0:max_distance
x=y/speed
plot(UIAxes1,x,y) %<-------------- this has a 'nice' x axis if plotted in seconds
then hit the edit plot button and figure(1) pops up which is ready for editing in the figure window to make it look nice for presentation etc.
figure(1)
plot(x,y) %<-------------- the figure pops up in a window and I can add legends, axis labels etc.
Then someone comes along and changes the speed to:
speed=10000000 (m/s)
max_distance = 100 (m)
Then the plot would give time (x) and distance (y)
y=0:max_distance
x=y/speed
plot(UIAxes1,x,y) %<-------------- I dont care what the x-axis looks like here (and pretend I dont have access to this code)
figure(1)
plot(x,y) %<-------------- the figure pops up in a window NOW THE X-AXIS LABEL WOULD LIKE TO BE 'ns' and XData SCALED BY.*1e9
Essentially is there a tool to just arbitrarily scale the x-axis by some factor once the plot has been created?

 Akzeptierte Antwort

No, Mathworks does not supply a tool for that purpose. Some subsets of that behaviour are easy to program, but you specifically said that you do not want to do this by way of writing code.
Some of the details are more difficult to program. For example there might already be a data cursor callback that might be doing arbitrary transformation to the coordinates, so a thorough tool would have to locate the callback and reconstruct the implementing source code and rewrite it.

3 Kommentare

Thanks Walter, I defintely don't want it to be programatic. This is intended to be a GUI which plots a figure and then spits out a plot which can be scaled, annotated, resized etc arbitrarily with no programming knowledge or potentially without even having matlab on the GUI users end.
I dont understand this second point. If the plot has been created succesfully (with transformations of any kind applied) then surely every point on the plot is associated to a co-ordinate via the index of that point. Maybe I am wrong? this is why the lengths of vectors,matrices must be consistant with plotting.
Thanks for the fast repsonse the Walter.
If as an aside you have knowledge of a nice way of editing plots inside a GUI with minimal programming then I would be interested. For example creating a plot and then having two buttons (edit fields, sliders ....) which can independently scale the x and y axis of the current popped out figure then that may be cool.
I am thinking something like a get current figure type set up then a bunch of standard commands that extract associated data, perform scaling and replot. But I am very new to GUIDE and generally a lousy programmer.
You appear to be trying to create a gui for other people to use and you would like to reduce the amount of programming logic that they need.
What you asked us was for a way to do this change without any programming. What we can suggest is that you do the programming and supply a tool to your users, such as giving them a tool to scale axes and add labels and titles.
I thought this might be the solution. Thanks for the response Walter.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by