axes

matplotlib: adding second axes() with transparent background?

匿名 (未验证) 提交于 2019-12-03 01:55:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Define data x = np.linspace(0,2*np.pi,100) y = 2*np.sin(x) Plot fig = plt.figure() ax = plt.axes() fig.add_subplot(ax) ax.plot(x,y) Add second axis newax = plt.axes(axisbg='none') Gives me ValueError: Unknown element o , even though it does the same thing as what I am about to describe. I can also see that this works (no error) to do the same thing: newax = plt.axes() fig.add_subplot(newax) newax.set_axis_bgcolor('none') However, it turns the background color of the original figure "gray" (or whatever the figure background is)? I don't

Draw Cartesian Plane Graphi with canvas in JavaFX

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have this method to draw the Cartesian plane in JavaFX, using canvas public class Grafics extends StackPane { private Canvas canvas ; public void Grafics (){ GridPane grid = new GridPane (); grid . setPadding ( new Insets ( 5 )); grid . setHgap ( 10 ); grid . setVgap ( 10 ); canvas = new Canvas (); canvas . setHeight ( 500 ); canvas . setWidth ( 700 ); GridPane . setHalignment ( canvas , HPos . CENTER ); grid . add ( canvas , 0 , 2 ); GraphicsContext gc = canvas . getGraphicsContext2D (); gc . setFill ( Color . BLACK ); gc .

Aspect ratio in subplots with various y-axes

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like the following code to produce 4 subplots of the same size with a common aspect ratio between the size of x-axis and y-axis set by me. Referring to the below example, I would like all of the subplots look exactly like the first one (upper left). What is wrong right now is that the size of the y-axis is correlated with its largest value. That is the behaviour I want to avoid. import matplotlib.pyplot as plt import numpy as np def main(): fig = plt.figure(1, [5.5, 3]) for i in range(1,5): fig.add_subplot(221+i-1, adjustable='box',

Three.js: Show world coordinate axes in corner of scene

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is probably a very basic problem, but I haven't found a solution yet and it's been bugging me. I'd like to show arrows indicating the world coordinate directions (x, y, z) in the bottom right hand corner of the camera like is done in Maya, so that when rotating the camera around an object, or moving through a scene, you can still identify the directions of the world coordinates. I've tried to accomplish this using two different approaches and neither has worked so far. I have an object with three arrows as children using the THREE

Understanding tensordot

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: After I learned how to use einsum , I am now trying to understand how np.tensordot works. However, I am a little bit lost especially regarding the various possibilities for the parameter axes . To understand it, as I have never practiced tensor calculus, I use the following example: A = np.random.randint(2, size=(2, 3, 5)) B = np.random.randint(2, size=(3, 2, 4)) In this case, what are the different possible np.tensordot and how would you compute it manually? 回答1: The idea with tensordot is pretty simple - We input the arrays and the

Matplotlib: get and set axes position

只谈情不闲聊 提交于 2019-12-03 01:43:00
In matlab, it's straightforward to get and set the position of an existing axes on the figure: pos = get(gca(), 'position') set(gca(), 'position', pos) How do I do this in Matplotlib? I need this for two related reasons: These are the specific problems I'm trying to solve: I have a column of subplots where some have colorbars and some don't, and they aren't the same width i.e. the X axises don't align. The colorbar steals space from the axes. This also happens in matlab, and there I'd use the above trick to make all the axes equally wide by copying the width from an axes with a colorbar to

Plotting two axes in gnuplot

ぃ、小莉子 提交于 2019-12-03 01:11:23
Is it possible to plot two curves, with two corresponding axes in gnuplot, each of which has a different scale? For example, y=x**2 and y=x**4 in the same graph (they vary enough to be "uncomfortable" when plotted with the same scale). Andrew S You can have the axes handled automatically without you having to scale them yourself and keep auto-scaling: set terminal jpeg set output 'graph.jpg' set xrange [-10:10] set ytics 10 nomirror tc lt 1 set ylabel '2*x' tc lt 1 set y2tics 20 nomirror tc lt 2 set y2label '4*x' tc lt 2 plot 2*x linetype 1, 4*x linetype 2 axes x1y2 It is possible to set

There is a class matplotlib.axes.AxesSubplot, but the module matplotlib.axes has no attribute AxesSubplot

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The code import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) print type(ax) gives the output Then the code import matplotlib.axes matplotlib.axes.AxesSubplot raises the exception AttributeError: 'module' object has no attribute 'AxesSubplot' To summarize, there is a class matplotlib.axes.AxesSubplot , but the module matplotlib.axes has no attribute AxesSubplot . What on earth is going on? I'm using Matplotlib 1.1.0 and Python 2.7.3. 回答1: Heh. That's because there is no AxesSubplot class.. until one is needed, when

jupyter入门之Matplotlib

匿名 (未验证) 提交于 2019-12-03 00:30:01
Matplotlib中的基本图表包括的元素 x轴和y轴 axis 水平和垂直的轴线 轴标签 axisLabel 水平和垂直的轴标签 x轴和y轴刻度 tick 刻度标示坐标轴的分隔,包括最小刻度和最大刻度 x轴和y轴刻度标签 tick label 表示特定坐标轴的值 绘图区域(坐标系) axes 实际绘图的区域 画布 figure 呈现所有的坐标系 可以用下图来概括 依赖导入 import numpy as np import pandas as pd from pandas import Series,DataFrame import matplotlib.pyplot as plt %matplotlib inline 只含单一曲线的图 1、可以使用多个plot函数(推荐),在一个图中绘制多个曲线 2、也可以在一个plot函数中传入多对X,Y值,在一个图中绘制多个曲线 x = np.arange( 0 , 10 ,step= 1 ) s1 = Series(x,index=list( 'abcdefghij' )) s2 = Series(x** 2 ,index=s1.index) # 索引和值一起设置 plt.plot(x,x* 2 ,x,x* 3 ,x,x) 设置子画布 axes = plt.subplot() # 221的含义是将画布分为两行两列, #

matplotlib 快速绘图

匿名 (未验证) 提交于 2019-12-03 00:30:01
5.1 快速绘图 matplotlib的pyplot子库提供了和matlab类似的绘图API,方便用户快速绘制2D图表。让我们先来看一个简单的例子: # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt x = np . linspace ( 0 , 10 , 1000 ) y = np . sin ( x ) z = np . cos ( x ** 2 ) plt . figure ( figsize = ( 8 , 4 )) plt . plot ( x , y , label = "$sin(x)$" , color = "red" , linewidth = 2 ) plt . plot ( x , z , "b--" , label = "$cos(x^2)$" ) plt . xlabel ( "Time(s)" ) plt . ylabel ( "Volt" ) plt . title ( "PyPlot First Example" ) plt . ylim ( - 1.2 , 1.2 ) plt . legend () plt . show () ͼ5.1 matplotlib中的快速绘图的函数库可以通过如下语句载入: import matplotlib.pyplot