- Add a data tip at a point
- Right click on the data tip which will open a pop up menu, select the option "Edit Content and Style"
- In the "Data Tip Content -> DataTipRows" section click on "X", this will open properties of the x-axis datatip
- Now set the value you want to be displayed in the "Value" field, in above example it would be vector A
- Now whenever you will select a point in the graph, it will show the value of x not 1/x
How to plot with a reciprocal (1/x) scale
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Maruan Alberto Bracci
am 3 Mai 2021
Beantwortet: Jayant Gangwar
am 6 Okt. 2022
Hi everybody,
I have some sets of data: [x1] and [y1], [x2] and [y2], ...The x axes have been obtained by calculating (with a complex operation) the reciprocal of the sets [A], [B], ...When I plot x1 vs y1, x2 vs y2, ... the data points are no longer equally spaced in the plot (very crowded at one side of the plot). Something like that:
A = linspace(1,50,100);
B = linspace(10,70,80);
x1 = 1./A; %semplified version of the real calculation
x2 = 1./B;
y1 = rand(100,1);
y2 = rand(80,1);
plot(x1,y1,'-o',x2,y2,'-o')
What I need is
- that the data points are equally spaced
- that the labels of the horizontal axis correspond to x
- when a point from the graph is selected, it shows the value of x and not 1/x.
What I did to solve the point 1 is plotting 1./x1 and 1./x2.
plot(1./x1,y1,'-o',1./x2,y2,'-o')
To solve point 2, I have used 'Xtick' and 'XTickLabel' to manually set the labels. I found no solution to point 3. I would like to use something like semilogx, but for reciprocal scales. Does it exist?
Thx for your time
0 Kommentare
Akzeptierte Antwort
Jayant Gangwar
am 6 Okt. 2022
Hi Maruan,
To achieve your 3rd point you can edit the content being displayed using the UI in the figure.
The steps to do so are -
0 Kommentare
Weitere Antworten (1)
Sambit Supriya Dash
am 7 Mai 2021
Supposing this example from the MATLAB previous codes,
A = [0.5,0.65,0.7,0.66,0.81]; % The plotting function values
B = [5,10,20,100,1000]; % The x-axis levels
plot(A);
xticks(1:length(A));
xticklabels(string(B));
1 Kommentar
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!