yaxis

Adding second Y axis on ggplotly

旧街凉风 提交于 2020-01-24 09:42:06
问题 I have created the following dataframe object and graph using plotly and ggplot library(ggplot2) library(plotly) rdate <- function(x, min = paste0(format(Sys.Date(), '%Y'), '-01-01'), max = paste0(format(Sys.Date(), '%Y'), '-12-31'), sort = TRUE) { dates <- sample(seq(as.Date(min), as.Date(max), by = "day"), x, replace=TRUE) if (sort == TRUE) { sort(dates) } else { dates } } DF<-data.frame(Date = rdate(100)) DF$variable<-LETTERS[seq( from = 1, to = 10 )] DF$Value<-round(runif(1:nrow(DF),min =

How do I properly loop through the subplots of a matplotlib figure to show the final y-axis value of each line?

浪尽此生 提交于 2020-01-22 03:32:04
问题 I currently have a matplotlib figure with 16 subplots, 4 columns and 4 rows. I have the following code produced that loops through each subplot and plots different data on each of the 16 subplots: fac_list = [one, two, three, four, five, six, seven, eight, nine, ten , eleven, twelve, thirteen, fourteen, fifteen, sixteen] color = ['blue','red'] ds_i = 0 for row in range(0,subplot_shape[0]): for col in range(0,subplot_shape[1]): fac = fac_list[ds_i] plot('total', currentname=fac, subplot_index=

How to set tics in x or y axis using range in GNU Octave?

一个人想着一个人 提交于 2020-01-05 07:08:14
问题 length of x = 1000, length of y = 1000 plot(x, y, '+'); xlabel ("p"); ylabel ("Q(p)"); title('Custom plot'); set(gca, 'xtick', [0.00000 0.20000 0.40000 0.60000 0.80000 1.00000]) This set command creates 6 tics in X axis, but I like to create 20 ticks so that there are 50 elements in between 2 tics. Thanks in advance. 回答1: From your comment I guess you don't know the concept behind Octaves "range". see here In your case if you want the xticks go from 0 to 1000 and the difference between the

How can I align the y-axis (latitudes) of a map plot and a plot in python

一个人想着一个人 提交于 2019-12-24 07:10:25
问题 I'm trying plot two panels in a plot. The first one (left) is a data with latitude values in its y-axis. The second panel is a map. I wanna that the latitude values of both panels coinciding, but I don't know how get it. I have a code like this: fig_mapa= plt.figure() '''Mapa''' ax1=fig_mapa.add_subplot(122) map = Basemap(llcrnrlon=-90,llcrnrlat=-58.1,urcrnrlon=-32,urcrnrlat=12.6, resolution='f',projection='merc',lon_0=-58,lat_0=-25, ax=ax1) map.drawparallels(np.arange(-90,90.,5), labels=[0,1

How to add more Y-axes to MSChart with different scale at left or right side

此生再无相见时 提交于 2019-12-19 09:58:04
问题 I want to add 3 Y-axes for the chart with different scales. I want to get one x axis and different y axis. I did it like below code but I want to show one y axis like in the 2nd image that I attached.. My C# code so far: private void checkBoxUseMultipleYAxis_CheckedChanged(object sender, EventArgs e) { if (checkBoxUseMultipleYAxis.Checked) { // Set custom chart area position chart1.ChartAreas["ChartArea1"].Position = new ElementPosition(25, 10, 68, 85); chart1.ChartAreas["ChartArea1"]

Android OnTouch swipe up/down direction change

这一生的挚爱 提交于 2019-12-11 06:34:38
问题 I'm trying to detect when an swipe direction was changed while the user still swipes on the screen. I have something like this (very basic) for detecting the swipe direction: @Override public boolean onTouch(View view, MotionEvent motionEvent) { int action = motionEvent.getActionMasked(); switch (action) { case MotionEvent.ACTION_DOWN: { Log.d(TAG, "onTouch: DOWN _Y = " + motionEvent.getRawY()); mLastTouchY = mPrevTouchY = motionEvent.getRawY(); break; } case MotionEvent.ACTION_MOVE: { Log.d

Y-break with scale change in R

六月ゝ 毕业季﹏ 提交于 2019-11-29 15:32:39
问题 I am still new to R. I agreed to help a friend replot his graphs however one of his plot designs is proving quite hard to reproduce. This is because he inserted a Y-axis break followed by a scale alteration on a barplot. This is illustrated by the example picture below. Unexpectedly this is proving hard to implement. I have attempted using: barplot() #very hard to implement with all elements, couldn't make it gap.barplot() #does not allow for grouped barplots ggplot() #after considerable time

Combining Bar and Line chart (double axis) in ggplot2

北战南征 提交于 2019-11-27 03:40:33
I have double-y-axis chart made in Excel . In Excel it requires only basic skills. What I'd like to do is to replicate this chart using the ggplot2 library in R . I have already done this, but I need to plot Response on 2nd-y-axis . I enclose reproducible code I've used: #Data generation Year <- c(2014, 2015, 2016) Response <- c(1000, 1100, 1200) Rate <- c(0.75, 0.42, 0.80) df <- data.frame(Year, Response, Rate) #Chart library(ggplot2) ggplot(df) + geom_bar(aes(x=Year, y=Response),stat="identity", fill="tan1", colour="sienna3")+ geom_line(aes(x=Year, y=Rate),stat="identity")+ geom_text(aes