How to make plot, with different scales on one axis

9 次查看(过去 30 天)
Hi, I am trying to plot characteristic of photodiode. My problem is I can't find how to split the axis to two different scales in order to display the data appropriately.
You can see my script in the source.
My first data are here:
neosvicena_U = [-4 -2 -1 0 0.1 0.2 0.3 0.4 0.5 0.6];
neosvicena_I = [-11.4 -5.7 -3.4 -0.4 2.3 14.2 74.7 282.4 892 3513];
I have only managed to make x and y axis and also tick important values but dont know how to implement different scales.
Any help would be appreciated, thanks!

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-10-11
Read my answer here: https://www.mathworks.com/matlabcentral/answers/601147-extending-specific-y-axis-values#answer_501697. It shows how to combine two axes to show different scales on the y-axis.
  5 个评论
Jan Mares
Jan Mares 2020-10-12
编辑:Jan Mares 2020-10-12
all my code is in the pinned png image, I have kinda managed some solution now.. it looks at least similar to what I wanted.
clear all
neosvicena_U = [-4 -2 -1 0 0.1 0.2 0.3 0.4 0.5 0.6];
neosvicena_I = [-11.4 -5.7 -3.4 -0.4 2.3 14.2 74.7 282.4 892 3513];
x = neosvicena_U ;
y = neosvicena_I ;
ax1 = axes('Position', [0.1 0.1 0.8 0.4]);
ax1.XLim = [-5 1];
ax1.YLim = [-12 70];
hold on;
plot(x, y);
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
xlabel('U [V]')
ax2 = axes('Position', [0.1 0.5 0.8 0.4]);
ax2.XAxis.Visible = 'off';
ax2.YScale = 'log';
ax2.XLim = [-5 1];
ax2.YLim = [70 3500];
hold on;
plot(x, y);
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
title('Neosvícená dioda')
xlabel('U [V]')
ylabel('I [microA]')

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by