YAxis property of an Axes read-only, but XAxis and ZAxis are not.

12 ビュー (過去 30 日間)
Kathleen Morrison
Kathleen Morrison 2019 年 7 月 16 日
編集済み: Kathleen Morrison 2019 年 7 月 17 日
I discovered that the YAxis property of an Axes is considered read-only, but the XAxis and ZAxis properties can be set and get. I was wondering if there was a specific reason for this, or if this is an oversight. Why is the YAxis property read-only, but the XAxis and ZAxis properties are not?
  9 件のコメント
Adam
Adam 2019 年 7 月 17 日
Yeah, that's what I was meaning. I agree that setting YAxis as an entity is not something I would ever be trying to do, although if it were to recreate an axes with all the same properties and the yAxis could simply be saved as an object then re-assigned later that would make some sense.
Kathleen Morrison
Kathleen Morrison 2019 年 7 月 17 日
編集済み: Kathleen Morrison 2019 年 7 月 17 日
That is exactly what we're trying to do. We are saving all of the properties in a structure so that the objects can be recreated with the same properties. We have class definitions for each handle type and we are saving the structures within the objects properties.
We are developing an application that an end user will use to select and plot data. The user should be able to edit the figure and axes properties at will such as changing tick mark labels, legend labels, colors of the traces, the colormap itself, any of the labels, the title, etc. As long as the figure doesn't get closed there isn't a problem, but we want to recreate the figure exactly as the user had it if it does get closed and they didn't mean to.

サインインしてコメントする。

採用された回答

Steven Lord
Steven Lord 2019 年 7 月 16 日
I needed to write code that saved the properties of the axes handle and then removed the read-only properties from the structure. I also needed to remove the individual handles as well and save those as structures, so that when the figure is closed I can recreate the figure by setting a new handle to the previous values without needing to save it as a .fig which will not work for my application.
Trying to generate code from your figure yourself is probably going to be difficult. If you're doing this interactively, use the Generate Code option on the File menu to create code that you can run (with the original data) to recreate the figure.
  1 件のコメント
Kathleen Morrison
Kathleen Morrison 2019 年 7 月 17 日
We are writing an application for the end user to plot data that is uploaded and they are able to edit the figure, open additional figures, etc. If the figure is closed it needs to be able to be recreated, but we don't want to save the figure as a file because we don't want to deal with the file management that comes with it. The generate code won't work because it is a menu option. We are trying to automate everything without the user needing to know much about how to use Matlab. We have class def files for everything. I'm going to accept this answer because it probably would work, but just not in the way that is needed.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by