Convert plotted graph to (x,y) coordinates?

Hi all,
I have a plotted graph and I wanted to know if it is possible to "convert" the plot by the graph() function to a plot in a (x,y) axis (like a scatter plot), but it is very important that is preserves the look of the plot! Is this possible in any way?
Thank you very much!

16 件のコメント

KSSV
KSSV 2017 年 8 月 9 日
If you have data (x,y) in hand....use scatter
Felipe  Schuback
Felipe Schuback 2017 年 8 月 9 日
Hi - thanks for your answer. I already managed to plot de x,y coordinates corresponding to the graph plot. Do you know how to draw an arrow between points in the scatter plot? And if it is possible to draw lines and arrow-lines in the same scatter plot?
Best
José-Luis
José-Luis 2017 年 8 月 9 日
You could use quiver() and superimpose it to your plot.
Felipe  Schuback
Felipe Schuback 2017 年 8 月 9 日
But would it be possible to format the line of the arrow using quiver()? For example, get it colored, or make it dashed?
José-Luis
José-Luis 2017 年 8 月 9 日
Felipe  Schuback
Felipe Schuback 2017 年 8 月 9 日
thank you very much for the help!
Felipe  Schuback
Felipe Schuback 2017 年 8 月 10 日
Hi José-Luis! I plotted a quiver arrow to join two points in my scatter plot and the formatting of this arrow is really important to get my task done. When I tried to, for example, format the LineStyle to '--' (dashed), the arrow head also became dashed. Is it possible to format the arrow stem only? I would like to format the arrow stem (dashed, etc) but maintaining the arrow head line style as solid line. Is this possible in any way?
Besides that, how do I choose the direction of the arrow in quiver plot?
José-Luis
José-Luis 2017 年 8 月 10 日
Not gonna happen automagically, please see answer below.
You choose the direction by defining the starting point and the vector direction. I don't think it's just an option you can change. You'd need to reverse that.
Please accept the answer that best solves your problem.
Walter Roberson
Walter Roberson 2017 年 8 月 10 日
You asked about the solid head in a new Question. I answered there:
h = quiver(...., 'LineStyle', '--') %use the linestyle appropriate for the body
h.Head.LineStyle = 'solid'; %magic property, magic property value, notice this is not '-'
José-Luis
José-Luis 2017 年 8 月 10 日
I stand corrected. It apparently can happen automagically.
Only downside to it being undocumented is that it's, well, undocumented and can change without warning in a new release.
Prettier than my answer though.
Felipe  Schuback
Felipe Schuback 2017 年 8 月 11 日
Hi José! thank you VERY much for your help!! but just so I get it correctly... what exactly is undocumented and can change without warning?
Walter Roberson
Walter Roberson 2017 年 8 月 11 日
The "Head" property of quiver objects is not documented.
Felipe  Schuback
Felipe Schuback 2017 年 8 月 11 日
Got it. Thank you very much. One other thing I am struggling with... how can I color individual markers in scatter? I would test to see if condition is met for that marker, in case it is, color it red for example. is this possible?
Walter Roberson
Walter Roberson 2017 年 8 月 11 日
Sorry, only one color is possible for any one call to scatter()
Felipe  Schuback
Felipe Schuback 2017 年 8 月 11 日
I managed to do the individual coloring by inputting a color matrix when I call the scatter function. Is it possible to change the line colors in the scatter plot? Set all of them to black, for example?
Walter Roberson
Walter Roberson 2017 年 8 月 11 日
Ah yes, I forgot for a moment about specifying the individual colors for scatter().
scatter() plots do not have line colors.
If you are referring to quiver(), then you can use the 'Color' option to set the same color for all of the lines; however, it is not possible to use different colors for different lines in any one quiver() call.

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

回答 (1 件)

José-Luis
José-Luis 2017 年 8 月 10 日

0 投票

It ain't pretty but it works. As far as I understand there are no simple options you can set to get the look you want.
data = rand(10,4);
qH = quiver(data(:,1),data(:,2),data(:,3),data(:,4),0);
hold on
qH1 = quiver(data(:,1),data(:,2),data(:,3),data(:,4),0);
colorVector = rand(1,3);
qH2 = quiver(data(:,1),data(:,2),data(:,3),data(:,4),0);
colorVector = rand(1,3);
qH.LineStyle = '-';
qH.Color = colorVector;
qH1.LineStyle = '-';
qH1.Color = 'w';
qH1.ShowArrowHead = 'off';
qH2.LineStyle = '--';
qH2.Color = colorVector;
qH2.ShowArrowHead = 'off';

カテゴリ

ヘルプ センター および File ExchangeVector Fields についてさらに検索

質問済み:

2017 年 8 月 8 日

コメント済み:

2017 年 8 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by