axis

Manually setting xticks with xaxis_date() in Python/matplotlib

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been looking into how to make plots against time on the x axis and have it pretty much sorted, with one strange quirk that makes me wonder whether I've run into a bug or (admittedly much more likely) am doing something I don't really understand. Simply put, below is a simplified version of my program. If I put this in a .py file and execute it from an interpreter (ipython) I get a figure with an x axis with the year only, "2012", repeated a number of times, like this . However, if I comment out the line (40) that sets the xticks

Python matplotlib ValueError for logit scale axis label

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm getting what looks like a label positioning error when setting a label for a logit scale axis using matplotlib, here's my example: import matplotlib.pyplot as plt; from matplotlib.ticker import FormatStrFormatter; x = [1,2,3,4,5]; y = [0.1,0.2,0.3,0.4,0.5]; fig,ax = plt.subplots(); ax.set_ylim([0.005,0.99]); ax.set_yscale('logit'); ax.yaxis.set_minor_formatter(FormatStrFormatter("")); ax.set_xlabel("X axis"); ax.set_ylabel("Y axis"); #set y axis label (logit scale) ax.plot(x,y); plt.show(); plt.close(); Here's the trace: Traceback (most

Draw date on X axis and time on Y axis using ZedGraph and C#

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In ZedGraph, how do I draw a time (like 00:00, 02:00, 04:00, etc.) on the Y axis and date (like 12-Apr-11, 13-Apr-11, 14-Apr-11, etc.) on the X axis? The bar settings has been set to BarType.Stack . Sample code will be very helpful. 回答1: Here is a sample that I constructed. I was not sure what sort of data you would plot along the Y Axis using a time format except for something like an accrued amount of time (such as number of hours employees worked). ZedGraph uses an XDate format for time along the axes, which are doubles converted from

Pandas: IndexingError: Unalignable boolean Series provided as indexer

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to run what I think is simple code to eliminate any columns with all NaNs, but can't get this to work ( axis = 1 works just fine when eliminating rows): import pandas as pd import numpy as np df = pd.DataFrame({'a':[1,2,np.nan,np.nan], 'b':[4,np.nan,6,np.nan], 'c':[np.nan, 8,9,np.nan], 'd':[np.nan,np.nan,np.nan,np.nan]}) df = df[df.notnull().any(axis = 0)] print df Full error: raise IndexingError('Unalignable boolean Series provided as 'pandas.core.indexing.IndexingError: Unalignable boolean Series provided as indexer (index of

pandas分层索引的操作

怎甘沉沦 提交于 2019-12-03 08:45:53
pandas文档 https://pandas.pydata.org/pandas-docs/version/0.25.0/user_guide/advanced.html arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] tuples = index = list(zip(*arrays)) index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second']) s = pd.Series(np.random.randn(8), index=index) iterables = [['bar', 'baz', 'foo', 'qux'], ['one', 'two']] pd.MultiIndex.from_product(iterables, names=['first', 'second']) df = pd.DataFrame([['bar', 'one'], ['bar', 'two'],['foo', 'one'], ['foo', 'two']],columns=['first', 'second'])

Taking np.average while ignoring NaN's?

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a matrix with shape (64,17) correspond to time & latitude. I want to take a weighted latitude average, which I know np.average can do because, unlike np.nanmean, which I used to average the longitudes, weights can be used in the arguments. However, np.average doesn't ignore NaN like np.nanmean does, so my first 5 entries of each row are included in the latitude averaging and make the entire time series full of NaN. Is there a way I can take a weighted average without the NaN's being included in the calculation? file = Dataset("sst_aso

Matplotlib polar plot radial axis offset

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was wondering, is it possible to offset the start of the radial axis or move it outside of the graph. This is what I'm hoping to achieve: And this is what I have for now. I have read the documentation and different topics on SO, but I couldn't find anything helpful. Does that mean that it is not even possible if it is not mentioned anywhere. Thank you in advance. EDIT (added snippet of a code used to create the plot): ax = fig.add_subplot(111, projection='polar') ax.set_theta_zero_location('N') ax.set_theta_direction(-1) ax.plot(X,lines[li

JavaFX LineChart - ClassCastException because of the Axis' Type

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How do I specify the axis type for the chart from the FXML file? It seems like the default types are <String, Integer> . If I declare my injectable field as LineChart<Number, Number> lineChart , and the I create a data series with (Number, Number ), the program throws a ClassCastException . It is mandatory for a FXML File to be used. The worst case scenario would be that I created my chart manually. My best guess is that this is a bug. import java . io . IOException ; import java . net . URL ; import java . util . ResourceBundle ;

What is the meaning of “axis” attribute in a Pandas DataFrame?

霸气de小男生 提交于 2019-12-03 08:36:09
问题 Taking the following example: >>> df1 = pd.DataFrame({"x":[1, 2, 3, 4, 5], "y":[3, 4, 5, 6, 7]}, index=['a', 'b', 'c', 'd', 'e']) >>> df2 = pd.DataFrame({"y":[1, 3, 5, 7, 9], "z":[9, 8, 7, 6, 5]}, index=['b', 'c', 'd', 'e', 'f']) >>> pd.concat([df1, df2], join='inner') The output is: y a 3 b 4 c 5 d 6 e 7 b 1 c 3 d 5 e 7 f 9 Since axis=0 is the columns, I think tha concat() only considers columns that are found in both dataframes. But the acutal output considers rows that are found in both

Google Chart veritcal axis with percentage sign

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Im using google chart api to show line chart in my application, in that chart now i want to show the vertical axis values with percentage sign. for that i tried the following option chart.draw(data, {vAxis: {format:'#%'} } ); as mentioned in How do you set percentage in Google Visualization Chart API? by ' B Seven ' when using this method, the vertical axis values got multiplied by 100. i.e instead of '12%' - im getting 1200% in vaxis!!!! i have checked in https://developers.google.com documents also, i cant find any approach to do this. Is