I'm trying to create a world map for COVID19 confirmed cases in each country. The dataset only has four columns: country, longitude, latitude, and confirmed cases. The code below goes well on my friend's end. I get the grey background map but no points and legends showed. It's weird that no errors are warned in the console. Packages are installed, library() and all seem fine.
Here's what I did:
country <- read_csv("~/Desktop/country-coordinates-world.csv")
country[233,3]="US"
province_data=datad%>%left_join(country,by='Country')
qplot(longitude,latitude,data=country,color=I('blue'))+borders("world",size=0.5)
world <-map_data("world")
ggplot() +
geom_polygon(data=world, aes(x=long, y=lat, fill=group), fill="grey", alpha=0.3) +
geom_point(data=province_data,aes(x=longitude,y=latitude,size=`Confirmed`,color=`Confirmed`),alpha=0.5)
This is the picture I wish to see. But I only get a plain background without points, just like the pic on the upper left, smaller one
Related
the following image shows my actuall result of a merged modis image.
I used pyhdf.SD to open and manipulate and plot the data in a loop. It started on the right upper corner.
The plot is ok... put on some areas overlaped. The easiest way is to remove the black borders.
I wanted to use this:
np.ma.masked_where(rgb_projected==0.,rgb_projected)
rgb_projected is the original rgb matix.
rgb_projected = np.zeros((1000, 1000,3))
rgb_projected[:,:,0] = z_01[:,:]
rgb_projected[:,:,1] = z_02[:,:]
rgb_projected[:,:,2] = z_03[:,:]
rgb_projected.shape
whereAreNaNs = np.isnan(rgb_projected);
rgb_projected[whereAreNaNs] = 0.;
rgb_plot=np.ma.masked_where(rgb_projected==0.,rgb_projected)
The interesting thing is, that everything is True although the first valueas are 0.
Any ideas?
I am trying to write a pine script with two indicators one overlaid on the chart (EMA) and another on its own?(Stoch) I cannot seem to find any info on how to separate these (Visually) but keep them within 1 pine script, ie to be able to take trading decisions based on these.
The earlier answer from Luc is right, unfortunately. Each script can either create plots that are overlaid on the default price chart, or shown in a different pane, but not both. But there is a workaround.
Suppose you've made some non-trivial calculation in your script and you'd like to put it in different pane. E.g. the next code:
//#version=4
study(title="Stochastic", shorttitle="Stoch", format=format.price, precision=2)
periodK = input(14, title="K", minval=1)
periodD = input(3, title="D", minval=1)
smoothK = input(3, title="Smooth", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
plot(k, title="%K", color=color.blue)
plot(d, title="%D", color=color.orange)
h0 = hline(80)
h1 = hline(20)
fill(h0, h1, color=color.purple, transp=75)
// This next plot would work best in a separate pane
someNonTrivialCalculatedSeries = close
plot(ema(someNonTrivialCalculatedSeries, 25), title="Exporting Plot")
Because they have different scale, one of them most likely will break another indicator's scale.
So you'd like show Stoch in different pine, whereas ema() should be overlayed with the main chart. For that you should make the next steps:
Turn off in the study's the extra plot to return scale to normal:
Apply to the chart the next script:
//#version=4
study("NonOverlayIndicator", overlay=true)
src = input(defval=close, type=input.source)
plot(src)
Choose in the second's script inputs source required plot from the first script:
And voilĂ - you got the plots in different pines:
But if you want split the plots because you have retrictions on amount of studies you allowed to apply (e.g. 3 for free-account) - that won't help you.
It cannot be done. A script runs either in overlay=true mode on the chart, in which case it cannot direct plots elsewhere, or in a separate pane when overlay=false (the default).
When the script is running in a pane, it can change the color of the chart bars using barcolor(), but that's the only way it can modify the chart.
It is possible to rescale signals so that multiple bounded (e.g., 0-100, -1 to +1) signals generated by one script appear one on top of the other, but this is typically impossible in overlay mode, as the vertical scale varies with the bars on the chart. The only way for an overlay script to work with its own scale is when it uses No scale, but this prevents the indicator's plots to plot relative to price, and so the chart's bars.
Nice workaround from Michael.
Unfortunately, this only seems to work to pass data for one plot.
I would like to pass data for 3 different plots to the stock price graph.
If I try this, for 'input.source' I can only select the standard sources: "open, high, low, close ...". I can not select the data from other indicators.
If I remove plots 2 and 3, it works as Michael described.
Anybody has a workaround for the workaround..? ;-)
I am using wso2cep dashboard for displaying network traffic related information by exploiting various graphs. I was wondering if there is any way I can customize legend for each type of graph or set it globally as its create confusion for the viewer, elaborated in screen shot.
In piechart others = blue
In dest port vs src ip other = orange
One thing more
Scatter plot is shifted to left side of the window cutting ips on the y-axis and there is a space left on right side which can be used.
How can I drag the chart towards right side?
And also scatter chart is not rendering multiple y-axis values against single x-axis value. Here is the screen shot for that and values against it is plotted.
source_ip, source_port, destination_ip, destination_port, protocol
192.168.227.102,123,192.168.227.101,21,ftp
192.168.227.102,101,192.168.227.101,21,ftp
192.168.227.105,445,192.168.227.101,21,ftp
192.168.227.105,123,192.168.227.101,21,ftp
192.168.227.105,65576,192.168.227.101,22,ssh
192.168.227.109,123,192.168.227.101,22,ssh
192.168.227.109,123,192.168.227.101,22,ssh
192.168.227.109,3345,192.168.227.101,22,ssh
192.168.227.233,123,192.168.227.101,445,smb
192.168.227.233,123,192.168.227.101,445,smb
192.168.227.233,111,192.168.227.101,445,smb
192.168.227.202,123,192.168.227.101,3302,smtp
192.168.227.202,233,192.168.227.101,3302,smtp
192.168.227.102,123,192.168.227.101,3302,smtp
192.168.227.102,123,192.168.227.101,25,sql
192.168.227.102,123,192.168.227.101,25,sql
This is happening because generated gadgets are deciding the the color scale and domain dynamically based on the data that has been passed to chart.
If you want to explicitly specify the color domain and color scale you can configure those in generated gadgets by modifying the VizGrammar (which is the chart library used) configuration of the charts.
This can be done by changing chart api js file, there will be a config creation like this [1] and there add colorDomain for you predefined options like below. Then the domain will be defined statically without dynamically changing the order and the colors has to be constant
conf.colorDomain = ["MySQL","SMB","OTHER"]
Even you can define your own colors to
[1] https://github.com/wso2/carbon-analytics-common/blob/master/features/analytics-gadget-templates/org.wso2.carbon.analytics.gadget.chart.template.feature/src/main/charts/line-chart/api.js#L116
I have descriptions in the title area of the colorbox image display, with the left and right arrows at the bottom of the picture like a caption. I forgot how on earth I edited it since it was a while ago and am going nuts trying to figure it out. Can someone point me in the right direction? Basically I have a description from the database which shows up, like "Title, Width, Height, Medium Description" and I just want to change the order a little.
I finally figured it out, it's not in the jQuery colorbox which really should remain unaltered. Looks like I had a div in my php file and my changes were working except I neglected to change the echoed text description. So I had
<div class='single_image_div'>
<a class='gallery' href='../".$row['folder']."/".$row['location']."' title=
'".$row['title'].", ".$row['sizeW']."W by ".$row['sizeH']."H, ".$row['description']." ' border='none'>
<img src='../".$row['folder']."/".$row['location']." 'border='0' > </a><br>
Whereas I changed the order to: $row['sizeH']."H by ".$row['sizeW'] (Height first and then Width)
I changed the sizeH with sizeW but neglected to change the 'H' with the 'W' so the numbers were coming in correctly like 12ft W by 10ft H but I didn't realize they were correct and just had to swap so the H (Height. So now it reads properly as 12ft H by 10ft W, same numbers but now correctly marked.
A tempest in a teapot
I have a photoshop script that is cutting up layers of a PSD file into tiles (it's for a parallax game engine). This works well, but now I want to be able to create regions (rectangles) in the PSD that can be detected by the script and exported as json data.
Can anyone suggest a good way in Photoshop to a) visually create this information in the PSD and b) the script that would write out this data?
Any help would be greatly appreciated - this would remove about 3 manual, error prone steps from our current process if we can solve it...
If it's just rectangles that will hold the data for you then that's easy. You can just create a layer with a unique name, select the area that you need the data for, fill that with a single colour - say bright orange or something that will stand out. So now you have a layer with your region data. In your script get the layer by name
app.documents.getByName("Data_for_Region_1");
...and then you can then export that layer's data (co-ordinates - presumably) as a JSON file with layer bounds.
var x = parseFloat(app.activeDocument;.activeLayer.bounds[0])
var y = parseFloat(app.activeDocument;.activeLayer.bounds[1])
var x1 = parseFloat(app.activeDocument;.activeLayer.bounds[2])
var y1 = parseFloat(app.activeDocument;.activeLayer.bounds[3])
Hope this helps