graphing

Change matplotlib line style mid-graph

十年热恋 提交于 2019-12-18 07:46:13
问题 I'm graphing some data (two lines) and I'd like to change the line style for the portions of the lines where the difference between them is statistically significant. So, in the below image (now a link b/c anti-spam policies don't allow me to post an image) I'd like the lines to look different (i.e. dashed perhaps) up until they start converging at about 35 on the x axis. line plot Is there a way to do this easily? I have the values for the x axis where the differences are significant, I'm

Plot a line (y = 2x + 7) on a graph

北城余情 提交于 2019-12-13 12:23:09
问题 I am working on a scientific calculator in C#. I have the parsing engine and such, now I would like to add a graph so the user can plot a line. Is there any kind of control that will let me input a function and it will graph a line in the chart? I'm not talking about plotting individual points by the way. Take this linear equation in slope-intercept form for instance: f(x) = 2x + 7 The main goal is to allow the user to write 2x + 7 in a textbox, and then it will graph the line. It would be

Creating a subplot below a plot with an inset graph in python

那年仲夏 提交于 2019-12-13 01:25:17
问题 I currently have the graph attached. I want a separate graph underneath this one showing the difference between the two lines to visually show the functional approach to error analysis. How do I add a subplot below this graph with a space and new axes without effecting the size and shape of my current graph. My current code is: fig, ax = plt.subplots() plt.plot(x, y1, label = 'label1') plt.plot(x, y2, label = 'label2') plt.plot(x, y3, label = 'label2') plt.xlabel(u'Redshift (z)', fontname =

Plot table alongside sns.barplot

半世苍凉 提交于 2019-12-12 13:56:49
问题 #read data into dataframe con=pd.read_csv('testOutput.csv') ''' testOutput.csv looks like : Sample,Count sample1,99.9 sample2, 96.6 ''' ## set colours to increase with values sns.set(style="darkgrid") groupedvalues=con.groupby("Count").sum().reset_index() pal = sns.color_palette("Greens_d", len(groupedvalues)) rank = groupedvalues["Count"].argsort().argsort() #get summary stats of data summary=pd.DataFrame(con['Count'].describe()) #set limits maxLim=100 minLim=min(con['Count'])-0.1 #barplot

Change number of x ticks on time series using ggplot2

故事扮演 提交于 2019-12-12 13:02:46
问题 I'm trying to plot a time series x_output that looks like this: timestamp city wait_time weekday time 2015-07-14 09:00:00 Boston 1.6 Tuesday 09:00:00 2015-07-14 09:01:00 Boston 1.8 Tuesday 09:00:00 2015-07-14 09:02:00 Boston 2.4 Tuesday 09:00:00 2015-07-14 09:03:00 Boston 2.9 Tuesday 09:00:00 2015-07-14 09:04:00 Boston 4.5 Tuesday 09:00:00 2015-07-14 09:05:00 Boston 5.6 Tuesday 09:00:00 Here's how I'm plotting it: brks <- seq(1, length(x_output$timestamp), 10) brks_labels <- x_output[brks, ]

Graphing new users by date in a Rails app using Seer

戏子无情 提交于 2019-12-12 08:57:02
问题 I'd like to implement a rolling graph showing new users by day over the last 7 days using Seer. I've got Seer installed: http://www.idolhands.com/ruby-on-rails/gems-plugins-and-engines/graphing-for-ruby-on-rails-with-seer I'm struggling to get my brain around how to implement. I've got an array of the Users I want to plot: @users = User.all( :conditions => {:created_at => 7.days.ago..Time.zone.now}) Can't see the right way to implement the :data_method to roll them up by created_at date.

Calculating the slope of a series of values

夙愿已清 提交于 2019-12-12 08:45:22
问题 I have 2 arrays of equal length. The following function attempts to calculate the slope using these arrays. It returns the average of the slope between each points. For the following data set, I seem to be getting different values than Excel and Google Docs. double[] x_values = { 1932, 1936, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980 }; double[] y_values = { 197, 203, 198, 204, 212, 216, 218, 224, 223, 225, 236 }; public static double getSlope(double[] x_values, double[] y_values)

Axis numerical offset in matplotlib

余生颓废 提交于 2019-12-12 04:26:00
问题 I'm plotting something with matplotlib and it looks like this: I can't seem to figure out why the x-axis is offset like it is...It looks like it's saying, 'whatever you read from me, add 2.398e9 to it for the actual x value'. This is not quite what I want...Can I make it take only the first 4 digits, instead? This is representing frequency, so I'd like to see something that reads: 2000 or 2400 or 2800....I can add the 'MHz' part in the axis title...But, this is unreadable at a glance. Is this

How to add marker to matlab colorbar?

我的梦境 提交于 2019-12-11 14:16:05
问题 I want to add a tarker/special tick mark by specific values in my matlab colorbars. For example, lets say I have a colorbar scale from -20 to 60 and my critical value is 37.53, how can I add a marker by that value of the colorbar? 回答1: The colorbar is really an axes object, so you can add tickmarks like you would any axes: myTick = 37.53; c = colorbar(); ticks = get(c, 'YTick'); % Add your tick and sort so it's monotonically increasing ticks = sort([ticks myTick]); set(c, 'YTick', ticks);

Ignoring Time gaps larger than x mins Matplotlib in Python

安稳与你 提交于 2019-12-11 06:41:39
问题 I get data every 5 mins between 9:30am and 4pm. Most days I just plot live intraday data. However, sometimes I want a historical view of lets says 2+ days. The only problem is that during 4pm and 9:30 am I just get a line connecting the two data points. I would like that gap to disappear. My code and an example of what is happening are below; fig = plt.figure() plt.ylabel('Bps') plt.xlabel('Date/Time') plt.title(ticker) ax = fig.add_subplot(111) myFmt = mdates.DateFormatter('%m/%d %I:%M') ax