axes

Seaborn学习05:分布图(多坐标显示)

匿名 (未验证) 提交于 2019-12-03 00:05:01
import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set(style="white", palette="muted", color_codes=True) rs = np.random.RandomState(10) d = rs.normal(size=100) # 多个坐标显示 f, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 5)) sns.distplot(d, color="g", hist=False, kde_kws={"shade": True}, ax=axes[0]) # hist是否显示直方图 sns.distplot(d, color="m", ax=axes[1]) plt.show() 显示效果: 来源:博客园 作者: Jumpkin1122 链接:https://www.cnblogs.com/jumpkin1122/p/11519295.html

matplotlib(7)-- inside axes ; 不同数据共用X轴 ; animation 动画绘制

匿名 (未验证) 提交于 2019-12-02 23:52:01
1 import matplotlib.pyplot as plt 2 3 fig = plt.figure() 4 x = [1, 2, 3, 4, 5, 6, 7] 5 y = [1, 3, 4, 2, 5, 8, 6] 6 7 # below are all percentage 8 left, bottom, width, height = 0.1, 0.1, 0.8, 0.8 9 ax1 = fig.add_axes([left, bottom, width, height]) # main axes 10 ax1.plot(x, y, 'r') 11 #关于plot()函数参数设置,参考博文 https://blog.csdn.net/cjcrxzz/article/details/79627483 12 ax1.set_xlabel('x') 13 ax1.set_ylabel('y') 14 ax1.set_title('title') 15 16 # inside axes 17 ax2 = fig.add_axes([0.2, 0.6, 0.25, 0.25]) 18 ax2.plot(y, x, 'b') 19 ax2.set_xlabel('x') 20 ax2.set_ylabel('y') 21 ax2.set_title('title inside 1

ROS上用北通阿修罗手柄控制小乌龟

匿名 (未验证) 提交于 2019-12-02 22:56:40
文章借鉴了这边博客 https://blog.csdn.net/u014587147/article/details/75673110 。 这篇文章记录下自己操作过程中遇到的问题,更加适合新手。 1、使用终端分别运行下面三个命令,启动小乌龟和键盘操控。 roscore rosrun turtlesim turtlesim_node rosrun turtlesim turtle_teleop_key 接下来,查看节点与话题之间的关系 rqt_graph 界面如下 椭圆内的是节点,横线上是话题。通过rqt_graph可以看到,小乌龟turtlesim节点订阅/turtle1/cmd_vel话题.那么,我们可以通过向这个话题发布消息来控制小乌龟。接下来查看话题的类型 rostopic type /turtle1/cmd_vel 结果如下 geometry_msgs/Twist 再查看这个话题发布哪些消息来控制乌龟 rosmsg show geometry_msgs/Twist 结果如下 geometry_msgs/Vector3 linear float64 x float64 y float64 z geometry_msgs/Vector3 angular float64 x float64 y float64 z 由之前的经验,小乌龟的运动主要有线速度和角速度来控制

Removing frame while keeping axes in pyplot subplots

不羁岁月 提交于 2019-12-02 22:35:16
I am creating a figure with 3 subplots, and was wondering if there is any way of removing the frame around them, while keeping the axes in place? If you want to remove the axis spines, but not the other information (ticks, labels, etc.), you can do that like so: fig, ax = plt.subplots(7,1, sharex=True) t = np.arange(0, 1, 0.01) for i, a in enumerate(ax): a.plot(t, np.sin((i + 1) * 2 * np.pi * t)) a.spines["top"].set_visible(False) a.spines["right"].set_visible(False) a.spines["bottom"].set_visible(False) or, more easily, using seaborn : fig, ax = plt.subplots(7,1, sharex=True) t = np.arange(0,

Matlab: How to align the axes of subplots when one of them contains a colorbar?

江枫思渺然 提交于 2019-12-02 20:57:24
Minimal example: [x,y,z] = peaks(50); figure; subplot(5,1,1:4); pcolor(x,y,z); shading flat; colorbar; subplot(5,1,5); plot(x(end/2,:), z(end/2,:)); In this example I'd like to have the lower subplot show the cross-section of peaks along y=0 and the plot ending at the same position as the pcolor subplot, so that the x ticks are on identical positions. In fact, I don't need the duplicate x axis then. So, How to rescale the lower subplot such that the right limit matches the right limit of the upper one's plot part? (preferably such that the colorbar can be switched on/off without destroying

Preventing tic labels from resizing graph in gnuplot

百般思念 提交于 2019-12-02 16:10:00
问题 I'm trying to make a general plot where I don't know the range. Sometimes there will be more zero's or a "-" on the tic marks, which causes the graph area to contract. I would prefer the tic labels just extend farther to the left preserving the graph size. This helps with alignment which is a crucial part of these plots. Does anyone have an idea about how to do this? My searches haven't revealed anything yet. 回答1: You can use set lmargin to set a fixed left margin. With e.g. set lmargin 10

Matplotlib使用

做~自己de王妃 提交于 2019-12-02 12:28:23
Matplotlib 1)什么是Matplotlib 是专门用于开发2D、3D图表 以渐进、交互式方式实现数据可视化 2)Matplotlib的特征 可视化是在整个数据挖掘的关键辅助工具,可以清晰的理解数据,从而调整我们的分析方法。 能将数据进行可视化,更直观的呈现 使数据更加客观、更具有说服力 3)实现一个简单的Matplotlib画图 3.1 matplotlib.pyplot模块 matplotlib.pytplot包含了一系列类似于matlab的画图函数。 import matplotlib . pyplot as plt 3.2 图形绘制流程 1 . 创建画布 - - plt . figure ( ) plt . figure ( figsize = ( ) , dpi = ) figsize : 指定图的长宽 dpi : 图像的清晰度 返回fig对象 2 . 绘制图像 - - plt . plot ( x , y ) 以折线图为例 3 . 显示图像 - - plt . show ( ) 3.3.折线图绘制与显示 例如:展示北京一周的天气温度变化 import matplotlib . pyplot as plt # 1.创建画布 plt . figute ( figsize = ( 20 , 8 ) , dpi = 100 ) # 2.绘制折线图 plt . plot

Preventing tic labels from resizing graph in gnuplot

心已入冬 提交于 2019-12-02 09:54:51
I'm trying to make a general plot where I don't know the range. Sometimes there will be more zero's or a "-" on the tic marks, which causes the graph area to contract. I would prefer the tic labels just extend farther to the left preserving the graph size. This helps with alignment which is a crucial part of these plots. Does anyone have an idea about how to do this? My searches haven't revealed anything yet. You can use set lmargin to set a fixed left margin. With e.g. set lmargin 10 you fix the left margin to 10 character widths: set multiplot layout 2,1 set lmargin 10 set xrange [0:10] plot

Major and minor ticks with different style, whole page covered D3?

断了今生、忘了曾经 提交于 2019-12-02 09:25:58
I want to draw an axis with major and minor ticks that cover my whole page styled differently. I followed structure of this example, but I can't get it to work make different between major and minor ticks lines. Here is a picture represent what I'm looking for: This is my code: // Define identity (1:1) scales var x = d3.scale.identity().domain([0, 400]); var y = d3.scale.identity().domain([0, 300]); // Define container var chart = d3.select("body") .append("svg") .attr("class", "chart") .attr("width", 500) .attr("height", 400) .append("g") .attr("transform", "translate(40,20)"); // Draw X-axis

Can I get the axis that will be returned by `pyplot.subplots` inside the constructor for the figure it creates?

那年仲夏 提交于 2019-12-02 06:32:51
问题 I'm using a custom figure class in a call to pyplot's subplot() fig, ax = matplotlib.pyplot.subplots(FigureClass=MyFigure) and would like to use the axis object(s), ax , normally returned by subplot() , in the constructor to the custom figure class. For example, I'd like to take that axis and twin it: class MyFigure(matplotlib.figure.Figure): def __init__(self, *args, **kwargs): super(MyFigure, self).__init__(**kwargs) self.ax_one = self.method_that_gets_the_ax_returned_by_subplots() self.ax