axis

ggExtra plot format: similar marginal plots for different plot dimensions

匿名 (未验证) 提交于 2019-12-03 09:52:54
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question in regarding formatting plots produced using ggplot2 + ggExtra and is not related to any bug. require(ggplot2) #> Loading required package: ggplot2 require(ggExtra) #> Loading required package: ggExtra p1 <- ggplot(data = mpg,aes(x = cty,y = cty)) + geom_point()+ xlab("City driving (miles/gallon)") + ylab("City driving (miles/gallon)") ggMarginal(p = p1,type= "boxplot") The y-axis marginal plot in this chart is usually not similar to the x-axis marginal plot i.e. the width of the 2 boxplots are not similar. This problem become

Quaternion from two vector pairs

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have two vector pairs (before and after rotation). before rotation: [x1,y1,z1] [x2,y2,z2] after rotation: [x1',y1',z1'] [x2',y2',z2'] How to create a quaternion representing this rotation? 回答1: In most cases there is no rotation which transforms 2 vectors into 2 other vectors. Here is a simple way to visualize why: a rotation does not change the angle between vectors. If the angle between the 2 vectors before the rotation is different from the angle between the 2 vectors after the rotation, then there is no rotation which meets your

making numpy.nanargmin return nan if column is all nan

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to use numpy.nanargmin , so that it returns numpy.nan , on columns where there are only nans in them. Right now, it raises a ValueError , when that happens. And i cant use numpy.argmin , since that will fail when there are only a few nans in the column. http://docs.scipy.org/doc/numpy/reference/generated/numpy.nanargmin.html says that the ValueError is raised for all-nan slices. In that case, i want it to return numpy.nan (just to further mask the "non-data" with nans) this next bit does this, but is super-slow and not really

No serializer found for class error when I try to create a Web Service

匿名 (未验证) 提交于 2019-12-03 09:06:55
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I create a web service and it works fine when the return is List like this: @WebService public class IndicatorWSImpl extends SpringBeanAutowiringSupport implements IndicatorWS { @Autowired private HomeIndicadoresReportService homeIndicadoresReportService; @Override public List<String> entidades() { homeIndicadoresReportService.buildValuesToGraph(resultMesAtual, selectedEntity, selectedBS, selectedTS, selectedFunctionality, filter, false); List<String> lista = new ArrayList<String>(); for (EntityIndicatorVO entityIndicatorVO : resultMesAtual)

how to adjust # of ticks on Bokeh axis (labels are overlapping on small figures)

限于喜欢 提交于 2019-12-03 09:04:57
问题 I have a multi-figure Bokeh plot of vertically stacked & aligned figures. Because I want to align the plots vertically, the y-axis labels are rotated to be vertical rather than horizontal. In certain scenarios, Bokeh produces too many ticks, such that the tick labels overlap completely, making illegible. Here is an example: import bokeh.plotting as bp import numpy as np y = np.random.uniform(0, 300, 50) x = np.arange(len(y)) bp.output_file("/tmp/test.html", "test") plot = bp.figure(plot_width

How can I remove the top and right axis in matplotlib?

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Instead of the default "boxed" axis style I want to have only the left and bottom axis, i.e.: +------+ | | | | | | ---> | | | | +------+ +------- This should be easy, but I can't find the necessary options in the docs. 回答1: This is the suggested Matplotlib 2.0 solution from the official website HERE : import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2*np.pi, 100) y = np.sin(x) ax = plt.subplot(111) ax.plot(x, y) # Hide the right and top spines ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) #

R plot with strings showing in the axis

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am plotting number of residents against the dorm room numbers (4 digits). The room numbers are supposed to be strings. But when I used as.character(RmNum), the axis still shows as numeric. meanResidents = c(3, 4, 3, 2, 4, 5) rmNumber = c(2034, 3043, 4012, 2035, 2022, 3013) plot(as.character(rmNumber), meanResidents, xlab = as.character(rmNumber)) I would want the dorm numbers showing vertically in the axis. Can someone help me with that? 回答1: With the function axis you can specify the position of the axis, where to put the tick marks ( at

Calculate histograms along axis

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a way to calculate many histograms along an axis of an nD-array? The method I currently have uses a for loop to iterate over all other axes and calculate a numpy.histogram() for each resulting 1D array: import numpy import itertools data = numpy.random.rand(4, 5, 6) # axis=-1, place `200001` and `[slice(None)]` on any other position to process along other axes out = numpy.zeros((4, 5, 200001), dtype="int64") indices = [ numpy.arange(4), numpy.arange(5), [slice(None)] ] # Iterate over all axes, calculate histogram for each cell for

Constrain Mayavi mouse drag to rotating Earth around its axis

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Using iPython Notebook, I have been able to bring up a globe of the Earth with code like: from mayavi import mlab from mayavi.sources.builtin_surface import BuiltinSurface ocean_blue = (0.4, 0.5, 1.0) r = 6371 # km sphere = mlab.points3d(0, 0, 0, name='Globe', scale_mode='none', scale_factor=r * 2.0, color=ocean_blue, resolution=50) sphere.actor.property.specular = 0.20 sphere.actor.property.specular_power = 10 continents_src = BuiltinSurface(source='earth', name='Continents') continents_src.data_source.on_ratio = 1 # detail level continents

How to apply numpy.linalg.norm to each row of a matrix?

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a 2D matrix and I want to take norm of each row. But when I use numpy.linalg.norm(X) directly, it takes the norm of the whole matrix. I can take norm of each row by using a for loop and then taking norm of each X[i] , but it takes a huge time since I have 30k rows. Any suggestions to find a quicker way? Or is it possible to apply np.linalg.norm to each row of a matrix? 回答1: Note that, as perimosocordiae shows , as of NumPy version 1.9, np.linalg.norm(x, axis=1) is the fastest way to compute the L2-norm. If you are computing an L2-norm