フィルターのクリア

Semilog plot with background image

3 ビュー (過去 30 日間)
Stanley Kubrick
Stanley Kubrick 2015 年 2 月 19 日
コメント済み: Star Strider 2015 年 2 月 19 日
I've modelled lines from image files and now I want to check that what I've done is correct. I want to plot the equations I came up with on top of the image files. So far, I can create two different figures, but I cannot plot both on top of one another (preferably with the image file slightly transparent). I've see a solution for non-log plots, but cannot seem to find anything that would work in my case. See below the code, as well as 'sample.png'.
clear
clc
close all
%%Create X-Axis
x = linspace(0,100,1001);
%%Low Variables
al = 10.95138337;
bl = 7.440851134;
cl = 1.51185755;
dl = -0.162527357;
yl = al + bl*log(x) + cl*log(x).^2 + dl*log(x).^3;
semilogx(x,yl,'g')
hold on
grid on
%%Medium Variables
am = 20.6143819;
bm = 9.539354014;
cm = 1.206316519;
dm = -0.129084187;
ym = am + bm*log(x) + cm*log(x).^2 + dm*log(x).^3;
semilogx(x,ym,'y')
%%High Variables
ah = 30.29206721;
bh = 12.42540544;
ch = 1.390071294;
dh = -0.26660217;
yh = ah + bh*log(x) + ch*log(x).^2 + dh*log(x).^3;
semilogx(x,yh,'r')
%%Plot the image
im = imread('sample.png');
figure
%define plot extent so that image can be aligned with plot
xrng = [0 100];
yrng = [0 100];
imagesc(xrng,yrng,im);
ax1 = gca;
%get rid of pixel ticklabels
set(ax1,'YTickLabel', [], 'XTickLabel', [])
%color=none to make the image visible
ax2 = axes('Position',get(ax1,'Position'),'Color','none','XScale', 'log');
ylim(yrng)
xlim(xrng)

回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by