axis

matplotlib: overlay plots with different scales?

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So far I have the following code: colors = ('k','r','b') ax = [] for i in range(3): ax.append(plt.axes()) plt.plot(datamatrix[:,0],datamatrix[:,i],colors[i]+'o') ax[i].set(autoscale_on=True) With the autoscale_on=True option for each axis, I thought each plot should have its own y-axis limits, but it appears they all share the same value (even if they share different axes). How do I set them to scale to show the range of each datamatrix[:,i] (just an explicit call to .set_ylim() ?) And also, how can I create an offset y-axis for the third

Using chart.addAxis and defining a title for the horizontal line on a Line graph the title is inverted

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do you define a title that will not be inverted on the horizontal axis of a line graph, using the chart.addAxis method. Currently my code is seen below. What happens is when the "X Axis" is rendered it is inverted upside down. chart1.setTheme(dojox.charting.themes.ThreeD); chart1.addAxis("x", { title: 'X Axis', range: { lower: 0, upper: 70}, //to enable scaling of ticks //majorTickStep: 4, //minorTickStep: 2, //microTickStep: 1 //to enable min and max range //min: 0, //max: 10, showTicks : true, min: 0, max: 10, fixLower: "major",

Force x-axis labels on facet_grid ggplot: x-axis labels differ per row

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I was so happy to find the greater part of a solution to my question in the post, " Force X axis text on for all facets of a facet_grid plot " . I'd like to create a graph to look somewhat like the OP Drew Steen's, except I have more than two rows of facets, and I'd like to make the x-axes labels different for each row. I made a super-hacky solution out of @baptiste's awesome answer (mostly because I am unfamiliar with the gtable package), and I'd like to know: If there is a more elegant solution than the mess I wrote below How to

Element-wise minimum of multiple vectors in numpy

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know that in numpy I can compute the element-wise minimum of two vectors with numpy.minimum(v1, v2) What if I have a list of vectors of equal dimension, V = [v1, v2, v3, v4] (but a list, not an array)? Taking numpy.minimum(*V) doesn't work. What's the preferred thing to do instead? 回答1: *V works if V has only 2 arrays. np.minimum is a ufunc and takes 2 arguments. As a ufunc it has a .reduce method, so it can apply repeated to a list inputs. In [321]: np.minimum.reduce([np.arange(3), np.arange(2,-1,-1), np.ones((3,))]) Out[321]: array([ 0.,

PHPExcel Chart not reversing the vertical axis

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm working with PHPExcel in order to export Excel chart with Bar Chart. I can export the chart with the default layout as this image: But, I want to make the axis layout at the top of chart and reverse the Y-axis as this image: How can I do that? 回答1: After researching the code I found that it is possible to reverse the axis: $yAxis = new \P HPExcel_Chart_Axis (); $yAxis -> setsetAxisOptionsProperties ( \P HPExcel_Chart_Axis :: AXIS_LABELS_NEXT_TO , null , null , \P HPExcel_Properties :: ORIENTATION_REVERSED ); $chart = new \P

medial axis transform implementation

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I implement the Medial Axis Transform algorithm to transform the first image into the second? thinning-L.gif http://www.cs.sunysb.edu/~algorith/files/thinning-L.gif thinning-R.gif http://www.cs.sunysb.edu/~algorith/files/thinning-R.gif What library in C++/C# have support for Medial Axis Transform? 回答1: There are many implementations of the medial axis transform on the Internet (personally I don't use OpenCV library but I'm sure it has a decent implementation). However, you could easily implement it yourself. In order to perform medial

ValueError: 'axis' entry is out of bounds // numpy

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here is my 2D numpy array: returns = np.array([ [ -4.78878057e-03 9.79090927e-03 -2.06883581e-03 -1.25786164e-02] [ 5.79128440e-03 -2.85791008e-03 1.69555388e-03 -5.63798220e-02] [ 5.73427375e-05 2.45043133e-02 8.55025651e-03 -4.53257790e-02] [ 6.75441635e-03 8.70168484e-03 1.07547532e-02 -1.36919315e-01] [ 6.68332655e-03 6.76498174e-03 3.08225775e-03 0.00000000e+00]]) And when I'm trying to calculate the STD for each column: print np.std(returns, axis=1) I'm getting the following error: ValueError: 'axis' entry is out of bounds How can I

customized “scale_color_gradient2” in ggplot2

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to use my own specific color in my image plot. I am very new in ggplot2 so had a look at its manual from here and tried to repeat some of the stuff; but I couldn't figure out how to supply my colorbar as I did for the graphics plot. library(reshape2) library(ggplot2) #my specific color list mycol <- vector(length=512, mode = "numeric") for (k in 1:256) mycol[k] <- rgb(255, k - 1, k - 1, maxColorValue=255) for (k in 257:512) mycol[k] <- rgb(511 - (k - 1), 511 - (k - 1), 255, maxColorValue=255) mycol <- rev(mycol) ncolors <-

Add data labels to excel pie chart

匿名 (未验证) 提交于 2019-12-03 08:50:26
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am drawing a pie chart with some data: private void DrawFractionChart(Excel.Worksheet activeSheet, Excel.ChartObjects xlCharts, Excel.Range xRange, Excel.Range yRange) { Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(200, 500, 200, 100); Excel.Chart chartPage = myChart.Chart; Excel.SeriesCollection seriesCollection = chartPage.SeriesCollection(); Excel.Series series1 = seriesCollection.NewSeries(); series1.XValues = activeSheet.Range["E1","E3"]; series1.Values = activeSheet.Range["F1","F3"]; chartPage.ApplyDataLabels(Excel

pandas层次化索引 ---- 索引的堆、聚合操作

蓝咒 提交于 2019-12-03 08:46:58
pandas层次化索引 import numpy as np import pandas as pd from pandas import Series,DataFrame import matplotlib.pyplot as plt 1. 索引的堆(stack) stack() unstack() 【小技巧】:使用stack()的时候,level等于哪一个,哪一个就消失,出现在行里;使用unstack()的时候,level等于哪一个,哪一个就消失,出现在列里。 df1 = DataFrame( np. random. randint( 0 , 150 , size =( 4 , 6 )), index = list ( '东南西北' ), columns= [[ 'python' , 'python' , 'math' , 'math' , 'En' , 'En' ] , [ '期中' , '期末' , '期中' , '期末' , '期中' , '期末' ] ]) df1.stack(level=- 1 ) df1.stack(level= 0 ) level代表的是层级,-1代表最内层,stack加ing列索引编程行的最内层索引 df2 = DataFrame(np.random.randint( 0 , 150 ,size=( 8 , 12 )), columns = pd