axes

How to use sec_axis() for discrete data in ggplot2 R?

笑着哭i 提交于 2019-12-23 10:07:06
问题 I have discreet data that looks like this: height <- c(1,2,3,4,5,6,7,8) weight <- c(100,200,300,400,500,600,700,800) person <- c("Jack","Jim","Jill","Tess","Jack","Jim","Jill","Tess") set <- c(1,1,1,1,2,2,2,2) dat <- data.frame(set,person,height,weight) I'm trying to plot a graph with same x-axis(person), and 2 different y-axis (weight and height). All the examples, I find is trying to plot the secondary axis (sec_axis), or discreet data using base plots. Is there an easy way to use sec_axis

How to use sec_axis() for discrete data in ggplot2 R?

柔情痞子 提交于 2019-12-23 10:05:53
问题 I have discreet data that looks like this: height <- c(1,2,3,4,5,6,7,8) weight <- c(100,200,300,400,500,600,700,800) person <- c("Jack","Jim","Jill","Tess","Jack","Jim","Jill","Tess") set <- c(1,1,1,1,2,2,2,2) dat <- data.frame(set,person,height,weight) I'm trying to plot a graph with same x-axis(person), and 2 different y-axis (weight and height). All the examples, I find is trying to plot the secondary axis (sec_axis), or discreet data using base plots. Is there an easy way to use sec_axis

setting the axis min and max values to stick

淺唱寂寞╮ 提交于 2019-12-22 09:58:00
问题 I have a (3,4) subplot each showing scatterplots. The ranges of the scatterplots vary so some of my plots have axes x(0-30) and y(0-8), but some have x(18-22) and y(4-7). I have set my xlim to [0 30], and ylim to [0 8] but that sets my axes to never go lower than 0, higher than 30 etc. How do I set my axis to "stick" at (0,0) for the origin of each plot, and "stick" at 8 for Y and 30 for X. TIA for any help update per comment on answer: Still having the same issue with below code %% plot for

matplotlib的usage guide学习

浪子不回头ぞ 提交于 2019-12-22 01:08:19
目录 参考 层级 对象 figure axes 数据 mpl, plt和pylab 代码风格 后端 指定后端 性能上的考虑 参考 主要参考官方文档 讲了一下“state-machine environment”,帮我理解了这个概念 层级 最高级:the matplotlib “state-machine environment”。看下面的例子,全程使用plt模块的函数做事情,不使用对象的方法和属性。 import matplotlib . pyplot as plt plt . figure ( 1 ) # the first figure plt . subplot ( 211 ) # the first subplot in the first figure plt . plot ( [ 1 , 2 , 3 ] ) plt . subplot ( 212 ) # the second subplot in the first figure plt . plot ( [ 4 , 5 , 6 ] ) plt . figure ( 2 ) # a second figure plt . plot ( [ 4 , 5 , 6 ] ) # creates a subplot(111) by default plt . figure ( 1 ) # figure 1 current;

Add legend outside of axes without rescaling in MATLAB

眉间皱痕 提交于 2019-12-21 07:11:53
问题 I've got a GUI in MATLAB with a set of axes pre-placed. I'm using the location property of the legend to place it to the right hand side of the axes. However, by doing this the axes get re-scaled so that the axes+legend take up the original width of the axes. Is there any way to circumvent the re-size? Example: x=0:.1:10; y=sin(x); figure pos=get(gca,'position'); pos(3)=.5; %#re-size axes to leave room for legend set(gca,'position',pos) plot(x,y) So far I get: Place legend: legend('sin(x)',

How to tell legends from axes in Matlab?

[亡魂溺海] 提交于 2019-12-21 01:12:12
问题 The following stackoverflow qestion: Matlab: How to obtain all the axes handles in a figure handle? identifies how to get handles to all of the axes from a figure in Matlab. However, this list will also contain handles to legends, at least in R2008a, which appear to also be axes. How can I tell (programatically) the legends from the real plot axes in a vector of axes handles? 回答1: From linkaxes , the code you want is: ax = findobj(gcf,'type','axes','-not','Tag','legend','-not','Tag','Colorbar

How to tell legends from axes in Matlab?

这一生的挚爱 提交于 2019-12-21 01:12:09
问题 The following stackoverflow qestion: Matlab: How to obtain all the axes handles in a figure handle? identifies how to get handles to all of the axes from a figure in Matlab. However, this list will also contain handles to legends, at least in R2008a, which appear to also be axes. How can I tell (programatically) the legends from the real plot axes in a vector of axes handles? 回答1: From linkaxes , the code you want is: ax = findobj(gcf,'type','axes','-not','Tag','legend','-not','Tag','Colorbar

Matplotlib三层结构

老子叫甜甜 提交于 2019-12-20 11:12:16
Matplotlib三层结构 容器层: 主要由Canvas、Figure、Axes组成。 Canvas是位于最底层的系统层,在绘图的过程中充当画板的角色,即放置画布(Figure)的工具。 Figure是Canvas上方的第一层,也是需要用户来操作的应用层的第一层,在绘图的过程中充当画布的角色。 Axes是应用层的第二层,在绘图的过程中相当于画布上的绘图区的角色。 Figure:指整个图形(可以通过plt.figure()设置画布的大小和分辨率等) Axes(坐标系):数据的绘图区域 Axis(坐标轴):坐标系中的一条轴,包含大小限制、刻度和刻度标签 注意点: 一个figure(画布)可以包含多个axes(坐标系/绘图区),但是一个axes只能属于一个figure。 一个axes(坐标系/绘图区)可以包含多个axis(坐标轴),包含两个即为2d坐标系,3个即为3d坐标系 。 辅助显示层 辅助显示层为Axes(绘图区)内的除了根据数据绘制出的图像以外的内容,主要包括Axes外观(facecolor)、边框线(spines)、坐标轴(axis)、坐标轴名称(axis label)、坐标轴刻度(tick)、坐标轴刻度标签(tick label)、网格线(grid)、图例(legend)、标题(title)等内容。 该层的设置可使图像显示更加直观更加容易被用户理解

plot: Decimal point accuracy on the axis

夙愿已清 提交于 2019-12-19 02:59:08
问题 I have two columns of data, X and Y with each entry having 4 places of data after the decimal in both the vectors. When I make the simple plot with plot(x,y) the axes have the data shown up to 2 decimal point accuracy. How do I change this to a 4 decimal point accuracy, on both axes? I've added the example data below ( inputData ), that I have plotted using plot(inputData) . inputData=structure(list(X = c(33.73521973, 33.622022, 33.63591706, 33.58184488, 33.73027696, 33.76169838), Y = c(-112

pytorch_小黄人项目

六眼飞鱼酱① 提交于 2019-12-19 02:28:05
前提:实验使用10000个样本。 其中,下文: 1.通道处理:用于将背景影像处理为通道相同的影像。 2.查看通道分离效果:用于查看通道分离结果。 3.创建数据:创建正负样本数据集。 1. 通道处理 from PIL import Image import os """通道处理""" def convertImage ( ) : listpath = os . listdir ( "data_image" ) print ( listpath ) for index , path in enumerate ( listpath ) : img = Image . open ( os . path . join ( "data_image" , path ) ) img = img . convert ( "RGB" ) #变换通道 img = img . resize ( ( 224 , 224 ) , Image . ANTIALIAS ) #变换尺寸 # img.show() img . save ( "images/{}.jpg" . format ( index ) ) #保存 if __name__ == '__main__' : convertImage ( ) 2. 查看通道分离效果 from PIL import Image # 查看通道分离效果 img =