loglog

MATLAB绘图

孤街浪徒 提交于 2021-02-20 02:57:05
一、直角坐标系中的连续函数 1.简单绘图 >>x=[0:0.1:5]; >>y=sin(x); >>plot(x,y),xlabel('x')/*横坐标*/,ylabel('y')/**纵坐标/; 2.更精确的图 fplot('exp(-1.2*x).*sin(x)',[0,4])/*在(0,4)上绘制图像*//*这里必须是点乘(矩阵相乘),直接*会报错*/,title('y=exp(-1.2x)*sin(x)的图像') 3.更多绘图选项 plot(x,y),grid on/*绘制网格*/,axis equal/*间距相同*/ /*axis auto是让MATLAB自动选择*/ 4.同时绘制多个函数 plot(x,y,t,f,'--')/*用默认实线绘制y=f(x),用'--'绘制f=f(t)*/ /*还有实线‘-’,虚线‘--’,虚点线‘-.’,点线‘:’*/ 还可以在图像旁添加图例用‘legend‘,即plot(x,yt,f,'--'),legend('sinh(x)','cosh(x)'),如下图: 5.个性化设置 (1)颜色 plot(x,y,'r--') /*用红色虚线绘制图像*/ (2)坐标比例 plot(x,y),axis([xmin xmax ymin ymax]) (3)一次显示两个坐标系 subplot(1,2,1) /*一行两列,当前函数在这行第一个*/ /

Fitting a straight line to a log-log curve in matplotlib

☆樱花仙子☆ 提交于 2020-01-02 07:06:20
问题 I have a plot with me which is logarithmic on both the axes. I have pyplot's loglog function to do this. It also gives me the logarithmic scale on both the axes. Now, using numpy I fit a straight line to the set of points that I have. However, when I plot this line on the plot, I cannot get a straight line. I get a curved line. The blue line is the supposedly "straight line". It is not getting plotted straight. I want to fit this straight line to the curve plotted by red dots Here is the code

Vertical line axvline plots line in wrong position in loglog plot in matplotlib

坚强是说给别人听的谎言 提交于 2019-12-24 04:09:07
问题 I have a problem using axvline to plot vertical lines in the loglog plot of matplotlib. The first problem is that the vertical lines do not appear at the right location. The second problem, possibly related is that when I zoom in or translate the plot, the vertical lines just stay in place and are not appropriately transformed by the translation (sliding the plot) or zooming into to the plot. My code looks as follows: import numpy as np import matplotlib.pyplot as plt f, axes = plt.subplots(1

How to add labels on each line and add 2nd y-axes to the right side of the 'loglog' plot?

会有一股神秘感。 提交于 2019-12-11 12:33:33
问题 Recently I am trying to implement the ISO classification for the roadway assessment. Please refer to the paper The use of vehicle acceleration measurements to estimate road roughness. But I bumped into some questions about plotting the ISO classification graph. The code is shown as follows: %% generate ISO Clasification Curve (m^2/(rad/m)) AngSpaFre = 10^(-3):0.01:10^2; % spatial frequency (rad/m) ParamTable = [0 1*10^(-6) 2*(10^(-6)); % ISO classification parameters 2*(10^(-6)) 4*(10^(-6)) 8

Fitting a straight line to a log-log curve in matplotlib

ε祈祈猫儿з 提交于 2019-12-05 12:59:29
I have a plot with me which is logarithmic on both the axes. I have pyplot's loglog function to do this. It also gives me the logarithmic scale on both the axes. Now, using numpy I fit a straight line to the set of points that I have. However, when I plot this line on the plot, I cannot get a straight line. I get a curved line. The blue line is the supposedly "straight line". It is not getting plotted straight. I want to fit this straight line to the curve plotted by red dots Here is the code I am using to plot the points: import numpy from matplotlib import pyplot as plt import math fp=open(

log-log plot with seaborn jointgrid

拟墨画扇 提交于 2019-12-03 08:48:44
问题 I'm trying to create a loglog plot with a KDE and histogram associated with each axis using a seaborn JointGrid object. This gets me pretty close, but the histogram bins do not translate well into logspace. Is there a way to do this easily without having to recreate the marginal axes? import seaborn as sns import matplotlib.pyplot as plt import numpy as np data = sns.load_dataset('tips') g = sns.JointGrid('total_bill', 'tip', data) g.plot_marginals(sns.distplot, hist=True, kde=True, color=