我使用命令subplot(1,2,1)
和subplot(1,2,2)
对图表进行了子图绘制。我绘制了数据。如你所见,我在图中有2张图。
我想改变两个图的y轴边界。
例如,我第一张图有ylim=[0 0.5]
,第二张图有ylim=[0 1.5]
。我想改变这些ylim的。
答案 0 :(得分:0)
首先,您需要访问您的数字:
public void encodeImagetoString() {
new AsyncTask<Void, Void, String>() {
protected void onPreExecute() {
};
@Override
protected String doInBackground(Void... params) {
BitmapFactory.Options options = null;
options = new BitmapFactory.Options();
options.inSampleSize = 3;
bitmap = BitmapFactory.decodeFile(imgPath, options);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 50, stream);
byte[] byte_arr = stream.toByteArray();
encodedString = Base64.encodeToString(byte_arr, 0);
return "";
}
@Override
protected void onPostExecute(String msg) {
Log.e("Success" , "Success");
}
}.execute(null, null, null);
}
现在您的子图存储在&#39; Children&#39;你的身材的领域。在这种情况下,它将是一个包含两个轴对象的单元数组,代表您的子图。
Myfig=gcf; %If the figure you want to modify is the current figure
Myfig=figure(1); %Replace 1 by the number of your figure, this command will make figure(1) your current figure and return its handle in Myfig.
更新:如果您已经知道先验要更改哪个子图,以及 AND 您要修改的数字是当前的图:
%If you don't have legends
Allsubplots=get(Myfig,'children');
% If you have legends, they will also appear as children of your fig
% Meaning you have to seek all fig's children that are of type 'axes'
Allsubplots=findobj(Myfig,'type','axes');
MySubplot1=Allsubplots(1);
MySubplot2=Allsubplots(2);
%%Change ylims of first subplot to [Ymin1 Ymax1] :
set(MySubplot1,'ylim',[Ymin1 Ymax1]);
%%Same for second subplot :
set(MySubplot2,'ylim',[Ymin2 Ymax2]);