How to plot a graph that has two x-axis?

I want to plot Extreme Value Type I,II,III distribution curve. How can I plot a graph that has two x-axis? One x-axis(main) which is 'reduced variate' is linear and the other x-axis(sub) which is 'year' is non-linear. It looks like as below.
one x-axis(main): reduced variate
-------------------------------------------
-2 -1 0 1 2 3 4 5 6
the other x-axis(sub): year
-----------------------
2 5 10 20 50 100

1 件のコメント

Priyank Sharma
Priyank Sharma 2016 年 5 月 16 日
I am also in search of the solution. If you find one, kindly share with me... My mail id is pjs230688@gmail.com

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

回答 (3 件)

Walter Roberson
Walter Roberson 2012 年 12 月 29 日

0 投票

In the File Exchange, you will find plotxx

5 件のコメント

Bum
Bum 2012 年 12 月 30 日
Thanks for the answer. But I don't want to plot two graphs. What I am going to do is to plot one graph(x and y) with two different x-axis scale. For example, x(year) varies from 1 to 100,000 and y~x is nonlinear. In this case it is difficult to find the trend in graph, so I use the reduced variate and then x and y relationship becomes linear and x axis also becomes simple. Finally I want to express the original x-axis, which might be non-linear on the transformed x-axis like below.
one x-axis(transformed x axis): reduced variate
-------------------------------------------
-2 -1 0 1 2 3 4 5 6
the other x-axis(original x-axis): year
-----------------------
2 5 10 20 50 100
Walter Roberson
Walter Roberson 2012 年 12 月 31 日
[ax, h1, h2] = plotyy(x,y,[2 nan 100], [min(y),nan,max(y)]);
set(ax(2), 'XScale', 'log')
Bum
Bum 2012 年 12 月 31 日
Thanks. How can I display not the original x-y gragh but only the original x-axis on the transformed x-axis? This is because through the transformed x-axis, transformed x and y relationship becomes linear but it does not give the original x-axis information which is 'year'. So I want to find out original x information 'year' on the transformed x-axis and y graph.
Walter Roberson
Walter Roberson 2012 年 12 月 31 日
Which do you consider your "main" axis, and which do you consider your "sub" axis? "Which" in the sense of which one is to be the upper axis and which one is to be the lower axis?
When you speak of "transformed", is that a log() transformation? You have already said it was non-linear, but you did not indicate whether that meant "log" ?
If the user clicks on points using the data cursor, then which values should be shown to them, the "transformed" values or the "original" values?
The (x,y) that you have available to plot: are those the already-transformed values or are they the "original" values?
Bum
Bum 2012 年 12 月 31 日
Sorry for my poor explanation. (1) The main axis(lower axis) is transformed axis and the sub axis(upper axis) is original axis. (2) The relationship between original x-axis(T) and transformed x-axis(Xt) is Xt=-ln[ln(T/(T-1)] (3) If I click on points, is it possible to show both transformed and original values? If it's impossible it is okay to show the transformed values. (4) The (x,y) that I want to plot is transformed values.

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

Scott
Scott 2012 年 12 月 31 日

0 投票

You have to be a little creative. I would start with the explanation at http://www.mathworks.com/help/matlab/creating_plots/using-multiple-x-and-y-axes.html. This isn't quite your case, but it explains how to do the overlays. You would plot the function twice on the two different axes. Then on the second one, you would need to use the 'XTick' and 'XTickLabel' properties to display the second axis as you described.
Malcolm Lidierth
Malcolm Lidierth 2012 年 12 月 31 日

0 投票

With Waterloo graphics, you can have any number of layered graphs each with independent axes (linear, log etc):
For MATLAB examples see:
For the project website see:

カテゴリ

ヘルプ センター および File ExchangeDiscrete Data Plots についてさらに検索

タグ

質問済み:

Bum
2012 年 12 月 29 日

コメント済み:

2016 年 5 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by