I'm not a dev, I'm doing this for a school project. I'm trying to put the following dataset into a surface plot in windows gnuplot. qt type terminal, if that's important.
https://files.catbox.moe/nbc6l1.json
As you can see, it's a huge set of data. Pulled directly from an image and into a csv file, which I converted to json.
When I type in "splot 'C:\Users\tyler\ESRP Data\sampleOutput.json'", this is what I get.
As you can see, there's only a single line, when there should be something approaching an intensity chart in a 3 dimensional space. Is it a problem with the data? Do I need a specific command to do this?
It would help if you attached an example of your image data to the question, and also if you provided a link to a plot similar to the one you are trying to create. There are many different styles one might use to represent a surface. I will attempt to guess at a possible solution.
Input image (scribbled in GIMP and saved as a png image):
Gnuplot surface plot:
set border -1
unset tics
# surface represented by colored lines in 3D
# down-sample by 4x in each dimension to get an interpretable surface
set palette defined (0 "blue", 1 "white")
splot 'scribble.png' binary filetype=png every 4:4:4 using 1:2:3:3 with lines lc palette
I have to "draw" a 3d function in gnuplot with the function sqrt(1-x**2+y**2), where the graph looks like a dome.
I am supposed to do it with unset parametric.
I just couldnt find out how to do it, any help would be appreciated.
First of all, your function sqrt(1-x**2+y**2) doesn’t represent the dome shape. The correct formula would be sqrt(1-(x**2+y**2)).
Then, even if you specify unset parametric, you can draw a dome shape by giving the function form to splot.
unset parametric
set xrange [-1.2:1.2]
set yrange [-1.2:1.2]
set isosamples 20,20
splot real(sqrt(1-(x**2+y**2))), sqrt(1-(x**2+y**2))
Many of the mathematical functions in gnuplot support complex numbers. sqrt(x) returns a complex number if x is negative. Note that such a value is treated like a missing value on a plot.
This script generates a figure like this (on pngcairo terminal).
I have 2 shapefiles that represent roads, let's call them shapes A and B. Each road is represented as line segments. File B is almost a superset of the other, with just a few roads of A not represented. File A with one segment selected (in red):
In this superset file (B), the segments are smaller. I can say that for every segment in A there are one or more segments in B. I believe there isn't a segment in B that corresponds to more than one segment in A. Here is shapefile B with one segment selected (in red):
The line coordinates aren't exact, just very near each other. Here are the coordinates of the leftmost dot of the selected line:
Dot in file A: -42.92896076999995 , -22.77139965999993
Dot in file B: -43.217942900516830, -22.888565009926047
I'm using geopandas.
How would I cross-reference the two datasets? For each line segment in file B find the associated segment in file A (if it exists)?
The question seems to depend on what you are using as a standard for cross-references. For example, you must first decide whether to assume a case where each segmentation intersects or whether to define it as the minimum distance between each segmentation.
Anyway, using geopandas or shapely for both is not a difficult task. After dividing all the segmentation of A into individual linestrings, you can use the overlay function of geopandas to find the occurrence of even a slight intersection with the segmentation of B.
You will have to decide whether to find the shortest distance orthogonal or the shortest distance between the start point and end point of each segmentation. You can use from shapely.ops import nearest_points etc. You can use all the features of shapely to target the geometry of geopandas.
So basically i'm trying to draw a multi line graph from the results of microsoft emotion api result data.
anger: 0.00108685507
contempt: 0.00179950753
disgust: 0.0000793820145
fear: 0.00272498373
happiness: 0.0000412895
neutral: 0.9678982
sadness: 0.0132255116
surprise: 0.0131443078
This is the result data.So what i want is to have a line drawn each time a result is obtained.And the line should be drawn from a combination of these results.Each line should be drawn from 4 points as the results have 8 fields which can be paired up into 4 points.
What it the best way to plot a vertical line using Octave?
So, I have two methods for this. One, I found, and the other I made up.
Method 1: From here.
%% Set x value where verticle line should intersect the x-axis.
x = 0;
%% plot a line between two points using plot([x1,x2],[y1,y2])
plot([x,x],[-10,10]);
Method 2: A slightly different approach, exact same result
%% Setup a vector of x values
x = linspace(0,0,100);
%% Setup a vector of y values
y = linspace(0,10,100);
%% Plot the paired points in a line
plot(x,y);
I think Method 2 may write more information to memory before the plot process and it's a line longer, so in my eyes, Method 1 should be the better option. If you prefer Method 2, make sure your x and y vectors are the same dimension or you'll end up with a bunch of dots where you're line should be.
Unfortunately the Octave documentation for doing obvious things can be ridiculously lousy with no working examples. Drawing a simple line on top of a plot is one.
As already mentioned, it's is very silly to plot straight lines in octave. It's a waste of memory and processing. Instead use the line() function, to draw on top of your plot.
The line() function require 2 non-standard x-values and y-values vectors, instead of the standard point-slope arguments for point A and point B, normally represented by (x1,y1) and (x2,y2). Instead, you need to write this as: X=(x1,x2) and Y=(y1,y2). Thus confusing every living soul!
Here is an example of the correct way to do this in Octave language:
pkg load statistics % Need to load the statistics package
x = randn (1,1000); % Normal Distribution of random numbers
clf; histfit(x) % Make a histogram plot of x and fit the data
ylim ([-20,100]) % Change the plot limits (to lift graph up)
% Draw the (vertical) line between (0,-10) and (0,90)
line ("xdata",[0,0], "ydata",[-10,90], "linewidth", 3)
With the result:
notation (x1,x2),(y1,y2) is really confusing and against textbooks.
Anyway, this is my way:
figure;
hold on;
% vertical line x=0
plot([0,0],[0,10]);
%horizontal line y=0
plot([0,10],[0,0]);
% vertical line x=2
plot([2,2],[0,10]);
hold off;