axes

How do I let my matplotlib plot go beyond the axes?

£可爱£侵袭症+ 提交于 2019-12-18 12:47:40
问题 I have to translate an image plotting script from matlab to matplotlib/pylab, and I'm trying to achieve the same effect as the matlab image below: As you can see, the z order of the plots seem to be higher than the z order of the grid, so the markers are not hidden by the axes. However, I can't figure out a way to do the same with my matplotlib image: I'm wondering if it is possible to get the same display without having to increase the limits of the y axis. 回答1: To get the marker to show

GGplot custom scale transformation with custom ticks

一个人想着一个人 提交于 2019-12-17 21:09:00
问题 I'm attempting to use a custom scale/axis transformation, like so: library(ggplot2) library(scales) dat <- data.frame( time.tot = c(407.17, 168.83, 127.8, 108.88, 69.04, 68.5, 59.76, 407.17, 168.83, 127.8, 108.88, 69.04, 68.5, 59.76, 407.17, 168.83, 127.8, 108.88, 69.04, 68.5, 59.76), error = c(0, 0.01, 0.05, 0.1, 0.5, 0.7, 1, 1.91e-06, 0.00229, 0.00884, 0.0172, 0.128, 0.128, 0.22, 1.43e-08, 0.000337, 0.00121, 0.00221, 0.0123, 0.0123, 0.0213, 0, 0.01, 0.05, 0.1, 0.5, 0.7, 1, 1.91e-06, 0.00229

【解决错误】ValueError: axes don't match array

大城市里の小女人 提交于 2019-12-17 19:06:52
Original Traceback (most recent call last): File "/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/cody/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/cody/anaconda3

How do I swap tensor's axes in TensorFlow?

荒凉一梦 提交于 2019-12-17 18:17:23
问题 I have a tensor of shape (30, 116, 10) , and I want to swap the first two dimensions, so that I have a tensor of shape (116, 30, 10) I saw that numpy as such a function implemented ( np.swapaxes ) and I searched for something similar in tensorflow but I found nothing. Do you have any idea? 回答1: tf.transpose provides the same functionality as np.swapaxes , although in a more generalized form. In your case, you can do tf.transpose(orig_tensor, [1, 0, 2]) which would be equivalent to np.swapaxes

Can I mimic a log scale of an axis in matplotlib without transforming the associated data?

一世执手 提交于 2019-12-17 16:53:16
问题 I am trying to display a Zipf plot, which is typically displayed on a log-log scale. I'm using a library which gives rank in linear scale and frequencies in log scale. I have the following code which plots my data fairly correctly: ranks = [3541, 60219, 172644, 108926, 733215, 1297533, 1297534, 1297535] # These frequencies are already log-scale freqs = [-10.932271003723145, -15.213129043579102, -17.091760635375977, -16.27560806274414, -19.482173919677734, -19.502029418945312, -19

Can I mimic a log scale of an axis in matplotlib without transforming the associated data?

旧城冷巷雨未停 提交于 2019-12-17 16:53:14
问题 I am trying to display a Zipf plot, which is typically displayed on a log-log scale. I'm using a library which gives rank in linear scale and frequencies in log scale. I have the following code which plots my data fairly correctly: ranks = [3541, 60219, 172644, 108926, 733215, 1297533, 1297534, 1297535] # These frequencies are already log-scale freqs = [-10.932271003723145, -15.213129043579102, -17.091760635375977, -16.27560806274414, -19.482173919677734, -19.502029418945312, -19

MATLAB how to get mouse click coordinates

爱⌒轻易说出口 提交于 2019-12-17 16:35:48
问题 I have made my GUI using GUIDE. I have an axes (tag=axes1). An image is displayed in the axes. When i click on the image(inside axes) I need to get the coordinates. I get the coordinate values when image is not added to axes.But image is displayed in axes do no obtain the axes. How to get the coordinates? 回答1: Let's assume that you've plotted the image with handle imageHandle that: imageHandle = imshow(imageObj); You should assign the ButtonDownFcn to the image handle not the axes handle that

How can I accomplish `set_xlim` or `set_ylim` in Bokeh?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 11:18:55
问题 I create a figure in a function, e.g. import numpy from bokeh.plotting import figure, show, output_notebook output_notebook() def make_fig(): rows = cols = 16 img = numpy.ones((rows, cols), dtype=numpy.uint32) view = img.view(dtype=numpy.uint8).reshape((rows, cols, 4)) view[:, :, 0] = numpy.arange(256) view[:, :, 1] = 265 - numpy.arange(256) fig = figure(x_range=[0, c], y_range=[0, rows]) fig.image_rgba(image=[img], x=[0], y=[0], dw=[cols], dh=[rows]) return fig Later I want to zoom in on the

How can I accomplish `set_xlim` or `set_ylim` in Bokeh?

感情迁移 提交于 2019-12-17 11:18:12
问题 I create a figure in a function, e.g. import numpy from bokeh.plotting import figure, show, output_notebook output_notebook() def make_fig(): rows = cols = 16 img = numpy.ones((rows, cols), dtype=numpy.uint32) view = img.view(dtype=numpy.uint8).reshape((rows, cols, 4)) view[:, :, 0] = numpy.arange(256) view[:, :, 1] = 265 - numpy.arange(256) fig = figure(x_range=[0, c], y_range=[0, rows]) fig.image_rgba(image=[img], x=[0], y=[0], dw=[cols], dh=[rows]) return fig Later I want to zoom in on the

Positioning axes labels

房东的猫 提交于 2019-12-17 10:26:40
问题 How can I move the y axis label from the left to the right of the plot area and the x-axis label from below to above the plot area in the following graph? Thanks xleft<-c(1,2,2.5) xright<-c(2,2.5,2.75) ybottom<-c(1,2,2.5) ytop<-c(2,2.5,2.75) par(mar = c(15,15,2.75,2.75) + 0.1) plot(c(1,3),c(1,3),type="n",main="title",xlab="xlab-move me above plot",ylab="ylab-move me right of plot",axes=F,asp=1) axis(1,pos=1) axis(2,pos=1) rect(xleft,ybottom,xright,ytop,col=c("blue","red","green")) #Label