multiple-axes

ggplot2: issues with dual y-axes and Loess smoothing

大憨熊 提交于 2019-12-24 11:05:10
问题 I'm a novice with R and ggplot. I recognize the power of R and elegance of ggplot and am trying to learn. Normally, I can find a solution online but have had no luck this time. I am trying to generate a chart in ggplot comparing Economic Freedom scores with Life Expectancy and Infant mortality using World Bank data (the csv data is included at the bottom of the post). I have had some success using this code (using the example at https://rpubs.com/MarkusLoew/226759): p <- ggplot(mydata, aes(x

matplotlib inset_axis inset placement has tick labels overlapping parent axes

我怕爱的太早我们不能终老 提交于 2019-12-24 10:46:13
问题 When I use inset_axes to place an inset in a figure, for small figure sizes, the tick labels for the inset will overlap the axes frame. Is there a way to make the figure adjust to avoid this problem? code: fig, ax1 = plt.subplots() ax1.plot(dd1["mag"].index, dd1["mag"], '.-',label="$\omega$") ax1.plot(newindex,curvy1,'--', label="${0:.3f} \cdot I$".format(popt1[0])) ax1.set_xlim((5e11, 5e13)) ax1.set_ylim((2e-7,.25e-4)) ax1_inset = inset_axes(ax1, width="40%", height="40%", loc=4) ax1_inset

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

Matplotlib parasite logarithmic axis ticks unwanted mirrorring

十年热恋 提交于 2019-12-23 12:09:30
问题 I'm trying to make a plot with two y-axes, one of them logarithmic and one linear, using host_subplot from mpl_toolkits.axes_grid1. The figure looks ok, with the exception of the minor ticks from the secondary y-axis (right) being also displayed on the primary y-axis (left), on the inside of the figure. import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA host = host_subplot(111) host.set_yticks(np.arange(-12, -3, 1.0)) par1 =

How to use sec_axis() for discrete data in ggplot2 R?

笑着哭i 提交于 2019-12-23 10:07:06
问题 I have discreet data that looks like this: height <- c(1,2,3,4,5,6,7,8) weight <- c(100,200,300,400,500,600,700,800) person <- c("Jack","Jim","Jill","Tess","Jack","Jim","Jill","Tess") set <- c(1,1,1,1,2,2,2,2) dat <- data.frame(set,person,height,weight) I'm trying to plot a graph with same x-axis(person), and 2 different y-axis (weight and height). All the examples, I find is trying to plot the secondary axis (sec_axis), or discreet data using base plots. Is there an easy way to use sec_axis

How to use sec_axis() for discrete data in ggplot2 R?

柔情痞子 提交于 2019-12-23 10:05:53
问题 I have discreet data that looks like this: height <- c(1,2,3,4,5,6,7,8) weight <- c(100,200,300,400,500,600,700,800) person <- c("Jack","Jim","Jill","Tess","Jack","Jim","Jill","Tess") set <- c(1,1,1,1,2,2,2,2) dat <- data.frame(set,person,height,weight) I'm trying to plot a graph with same x-axis(person), and 2 different y-axis (weight and height). All the examples, I find is trying to plot the secondary axis (sec_axis), or discreet data using base plots. Is there an easy way to use sec_axis

Why isnt Bokeh generating extra y ranges here?

你。 提交于 2019-12-20 05:28:06
问题 My Bokeh version is 0.12.13 and Python 3.6.0 I modified the example code available here: https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html I have just tried to add one extra y range. from bokeh.plotting import output_file, figure, show from bokeh.models import LinearAxis, Range1d x = [1,2,3,4,5] y = [1,2,3,4,5] y2 = [10,9,8,7,6] y3 = [23,24,25,26,27] output_file("twin_axis.html") p = figure(x_range=(0,6), y_range=(0,6)) p.circle(x, y, color="red") p.extra_y_ranges = {"foo1":

How to change the font size for multiple axes labels (created with host_subplot API)

偶尔善良 提交于 2019-12-14 02:33:04
问题 I looked on the internet and absolutely all the examples with multiple axes have the xlabel and ylabel at a default value and quite small I used the following code to create the axes: from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA ... ax=[] if twoaxes or threeaxes: ax.append(host_subplot(111, axes_class=AA.Axes)) plt.subplots_adjust(right=0.75) else: ax.append(fig.add_subplot(111)) if twoaxes or threeaxes: ax.append(ax[0].twinx()) if threeaxes: ax.append

Highcharts - Multiple Y Axis Stacked Charts

泄露秘密 提交于 2019-12-13 14:17:32
问题 I am creating a chart with two Y axes - distance and duration. Each Y axis will have multiple series ( run, bike, swim, etc.) stacked on top of one another. Duration is a stacked area or areaspline and distance is a stacked column chart. Here is the jsfiddle for the chart. http://jsfiddle.net/baberuth22/u5QCB/3/ $(function() { var run_data = [[1324771200000,2928000],[1325376000000,2148000],[1327190400000,1001000],[1327795200000,2336000],[1329609600000,2403000],[1330214400000,2456000],

Matplotlib: Polar plot axis tick label location

馋奶兔 提交于 2019-12-12 03:17:16
问题 How would you move the labels along each axis so they're all readable? For example, how would you move the '$156, $158, $160' out of the way of the axis? This post shows how you can move these labels if you only have one axis, but what would you do if you had multiple as in my situation? Move radial tick labels on a polar plot in matplotlib import numpy as np import pylab as pl import matplotlib.pyplot as py class Radar(object): def __init__(self, fig, titles, labels, rect=None): if rect is