axes

Custom logarithmic axis scaling in matplotlib

不打扰是莪最后的温柔 提交于 2019-12-28 04:32:11
问题 I'm trying to scale the x axis of a plot with math.log(1+x) instead of the usual 'log' scale option, and I've looked over some of the custom scaling examples but I can't get mine to work! Here's my MWE: import matplotlib.pyplot as plt import numpy as np import math from matplotlib.ticker import FormatStrFormatter from matplotlib import scale as mscale from matplotlib import transforms as mtransforms class CustomScale(mscale.ScaleBase): name = 'custom' def __init__(self, axis, **kwargs):

Axes class - set explicitly size (width/height) of axes in given units

旧巷老猫 提交于 2019-12-28 02:41:05
问题 I want to to create a figure using matplotlib where I can explicitly specify the size of the axes, i.e. I want to set the width and height of the axes bbox. I have looked around all over and I cannot find a solution for this. What I typically find is how to adjust the size of the complete Figure (including ticks and labels), for example using fig, ax = plt.subplots(figsize=(w, h)) This is very important for me as I want to have a 1:1 scale of the axes, i.e. 1 unit in paper is equal to 1 unit

R plot 2 axes multiple plots

空扰寡人 提交于 2019-12-25 16:53:18
问题 I'm trying to produce a very specific graphical output, and can't find a package that can do all of the things I'm looking for. Primarily, I need to: (1) Produce multiple plots (facet_wrap in ggplot works great) (2) Have 2 y-axes with different scales (lattice seems the best for this) (3) Produce a graph similar to the output from "plot" using dplR I have a data frame with multiple unique Sites. I'd like to plot each site's average annual value as a line graph, with a second line graph on the

Matlab: Add additional y axis (linearly scaled to original) and “print” to PDF without losing axis alignment

假如想象 提交于 2019-12-24 13:17:14
问题 I have a dataset with date/time along the x axis, and concentration on the first y axis, but would like to show the equivalent value in a different measure of concentration on a second y axis (like having cm on one y axis and inches on the other). I used gnovice's solution from here to add the extra axis: Different right and left axes in a MATLAB plot? It works beautifully for me on the screen: But when I "print" to PDF using print(gcf,'-dpdf',[filename '.pdf']) The lower end of the axis

Crossing axis and labels in matlab

浪子不回头ぞ 提交于 2019-12-24 04:49:05
问题 I just can't find it. How to set up axis and labels in matlab so they cross at zero point, with the labels just below the axis not on left/bottom of the plot ? If I didn't make myself clear - I just want the plot to look like like we all used to draw it when in school. Axes crossing, 4 quadrants, labels right below axis, curve ... as it goes. Anyone knows how to set it up ? 回答1: You should check out two submissions on The MathWorks File Exchange: PlotAxisAtOrigin by Shanrong Zhang axescenter

matplotlib imshow editing x-axis

烂漫一生 提交于 2019-12-24 02:44:11
问题 I want to display an amplitude spectrum of an image. I am able to do this using following code: import numpy as np import matplotlib.pyplot as plt import pylab pylab.gray() pic = pylab.imread("C:/pic.png")[::-1,:] amp_pic = pylab.subplot(1,4,1) amp_pic.xaxis.set_ticks_position('top') pylab.imshow(np.abs(np.fft.fftshift(np.fft.fft2(pic))),\ interpolation='nearest') pylab.show() But the axis is not labeled the way an amplitude spectrum should be labeled. In the case of a 1D-function the

matplotlib imshow editing x-axis

倖福魔咒の 提交于 2019-12-24 02:44:07
问题 I want to display an amplitude spectrum of an image. I am able to do this using following code: import numpy as np import matplotlib.pyplot as plt import pylab pylab.gray() pic = pylab.imread("C:/pic.png")[::-1,:] amp_pic = pylab.subplot(1,4,1) amp_pic.xaxis.set_ticks_position('top') pylab.imshow(np.abs(np.fft.fftshift(np.fft.fft2(pic))),\ interpolation='nearest') pylab.show() But the axis is not labeled the way an amplitude spectrum should be labeled. In the case of a 1D-function the

How to apply logarithmic axis labels without log scaling image (matplotlib imshow)

余生长醉 提交于 2019-12-24 00:57:52
问题 I have a large data set that is logarithmic in distribution. I want to make a heat map, so I do a 2D histogram and pass that to implot. Because the data is logarithmic, I am passing the log of the data to the histogram. When I make the plot, however, I want the axis to be restored (ie 10^hist bin values) and log axes. If I set the axis to log style, then the image looks all skewed. The data is already 'logged' from when I passed it to the histogram, so I don't want the image affected, just

Center Axes in oxyplot

妖精的绣舞 提交于 2019-12-23 20:26:48
问题 I want to draw a chart like image below with oxyplot, the problem is i don't know how to draw axis (with values) at value 50. Code : var model = new PlotModel { Title = "EllipseAnnotations" }; model.Axes.Add( new LinearAxis { Position = AxisPosition.Bottom, Minimum = 20, Maximum = 80, PositionAtZeroCrossing = true, ExtraGridlines = new[] { 50.0 }, ExtraGridlineStyle = LineStyle.Dash }); model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = 20, Maximum = 80,

Add (second) x axis to scatterplot to display group information

孤者浪人 提交于 2019-12-23 12:49:53
问题 I make a scatterplot using d3.js where the points are arranged by their name and an accompanying number. The data that is plotted would look like this: name, group, number "AB", "A", 0.5 "ABC", "A", 10.0 "BC", "B", 3.0 "BCD", "B", 5.0 "BCDE", "B", 0.3 "CD", "C", 1.6 "DE", "D", 1.5 What I want to achieve. What I want to achieve is a plot where the points are scattered on the x axis according to their name , but the x axis should display the group once per group and a tick between different