Plot a distorted x axis without changing shape

4 ビュー (過去 30 日間)
Enrico Gambini
Enrico Gambini 2021 年 3 月 20 日
コメント済み: Enrico Gambini 2021 年 3 月 20 日
Hello to everybody,
I'm trying to find a way to plot a distorted x axis without changing the shape of the plot.
For example.
x=[-2:0.1:4];
y=2+3*x;
plot(x,y); %straight line
I'd want to have the exact same shape of the graph (the line) but with the values of the x axes coming from the transformation:
T=1./(1-exp(-exp(-x)));
So that plot (T,y) will give the exact same line of before, but x axis will be distorted.
Hope it's clear
Thank you.

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 3 月 20 日
Your xticks and xticklabels do not need to be the same value. You can set the xticklabels to be whatever you want.
Perhaps something like this?
x=-2:0.1:4;
y=2+3*x;
plot(x,y); %straight line
% query the xtick values
xt = xticks;
% transform the xtick values
T=1./(1-exp(-exp(-xt)));
% update the xticklabels with the transformed values
xticklabels(T)
  1 件のコメント
Enrico Gambini
Enrico Gambini 2021 年 3 月 20 日
Thank you very much :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by