How to isolate grid lines on top of a curve Mathematica - grid

I am looking to plot a graph which has a semi circle from -3 to 3 on the x axis and 0 to 3 on the y axis. I would like for the semi circle and its interior to be untouched but the rest of the graph be filled with grid lines (with a point with increments of .06 for x and y values). I have been able to plot a graph with the semi circle and the grid lines but can't seem to figure out how to clear the semi circle of grid lines.
Any help would be greatly appreciated!
Here's what I have so far, with f[x] being the function for the semicircle and the xPoints and yPoints being the x and y coordinates.
Plot[f[x], {x, -3, 3},
GridLines -> {{xPoints},{yPoints}}]

try working with RegionPlot
RegionPlot[ x^2+y^2 < 9 , {x,-3,3 }, {y,0,3} , Mesh->10 , AspectRatio->Automatic,
MeshShading->{{None,None},{None,None}} ]
( Just switch the inequality to get the grid outside the curve )

Related

Draw quadratics with it crossing the x and y axis with points labled

I'm trying to draw curves and I need to have it crossing the x and y axis with where it crossing shown clearly on the graph.
Im using the code
curve(x^2-8*x+16, -2, 10)
this is making the curve I want but not showing the curve clearly crossing the axis
I have used Desmos to show what im aiming to create.

gnuplot strange behavior when not using "first" option

I was having trouble plotting a horizontal line
...
set arrow 2 from graph 0, y(x) to x, y(x) nohead
...
For clarity, assume that x = 1 => y = 3 So as far as I understood, that should have generated a line from (0,3) to (1, 3). However, the y coordinate of the first point (0,3) turned out to appear somewhere outside the plot. But if I use (according to a post here)
set arrow 2 from graph 0, first y(x) to x, y(x) nohead
then it yields the output I wanted.
Can someone explain to me the magic above using first?
It is worth reading help coordinates to learn about the different coordinate systems. In short, the first coordinate system is that defined by the current ranges of the x and y axes: the bottom left corner of the graph has coordinates (xmin,ymin), and the top right corner has coordinates (xmax, ymax). In the graph coordinate system the bottom left corner is always (0,0) and the top right corner is always (1,1), independent of the ranges of the two axes.
Here is a brief example:
set xrange [-4:4]
set yrange [-3:3]
set grid
set arrow 1 from first 0,0 to first 1,1 ls 1 lw 3
set arrow 2 from graph 0,0 to graph 1,1 ls 2 lw 3
plot 1/0 ti ""
The purple vector is arrow 1, which goes from (0,0) to (1,1) in the first coordinate system. The second vector is arrow 2, which goes from (0,0) to (1,1) in the graph coordinate system.
The default rules for which coordinate system will be used are
If the coordinate system for x is not specified, first is used. If
the system for y is not specified, the one used for x is adopted.
and for the special case of set arrow,
A coordinate system specifier does not carry over from the first endpoint description [to] the second.
It sounds like you want to use the first coordinate system, so you shouldn't have to do anything:
set arrow from 0, y(x) to x, y(x)
When you use
set arrow from graph 0, y(x) to x, y(x)
you use the graph coordinate system for the starting point, and the first coordinate system for the end point.
When you use
set arrow from graph 0, first y(x) to x, y(x)
you use the graph coordinate system for the starting point's x coordinate, and the first coordinate system for the remaining coordinates. If range of the x axis starts at zero, this would be the same as using the first coordinate system for everything.

gnuplot - "How to draw an asymptote" / "Get axis value range", get x or y axis minimum and maximum values

Is it possible to "get" the x/y (or other) axis plot range values?
The reason I am trying to do this is that I want to plot a vertical line on my graph at the position of an asymptotic point... Perhaps there is an alternative or better way of doing this than drawing an arrow (with no head) on the graph?
Thanks to #Christoph (again) I have been able to do the following:
#Plot asymptote
set arrow from b,graph 0 to b,graph 1 lt 2 lw 2 lc rgb "green" nohead
This code does the following:
draws an arrow
start position: x=variable b, y=graph 0 (minimum of graph [y] axis)
end position: x=variable b, y=graph 1 (maximum of graph [y] axis)
line type 2 (may require set termoption dashed to enable dashed lines, consult documentation)
line width 2
line color green
no arrow head (a line)

plot plane using 3 points in scilab

I have three points a,b,c whose x,y,z coordinates are
a=[ -0.3519052 0 0];
b=[ 0 -0.674984 0];
c=[ 0 0 -0.6485047];
how do plot a plane(triangle) using these three points in scilab
plot3d and plo3d1 are not giving the form i am looking for.
I figured out the problem!
plot3d1 needs column vectors.
plot3d1(a',b',c')
produced the plot
how to plot triangle in scilab
Plot a triangle using its sides
Consider the fist vertex lies at origin(0,0)
Second vertex lies on X-Axis at (a,0)
From distance formula of triangle
ie.
length of side = sqrt( (x2−x1)^2+(y2−y1)^2 )
Program to Plot a Triangle when sides are given is as below in scilab :
clf()
//Length of the sides
a = 10;
b = 10
c = 10
//Vertex of third point
xc=(a^2-(b^2-c^2))/(2*a)
yc=sqrt(c^2-xc^2);
clf()
x=[0,0,xc]
y=[0,yc,0]
plot2d(0,0,-1,"010","",[0,0,0,0]);
xpoly(x,y,"lines",1)

Draw a translucent sphere using rgl in R

I have a set of data, looks like:
x y z
1 1 2 1
2 3 5 7
3 -3 2 4
4 -2 1 1
so each row record the dot coordinate in a 3-D space. I want to plot all the dot as points except for one, say no.15 as a translucent sphere, with radius I can set. Then I can see from the plot that which of those points in the data are included in the sphere. I'm using RGL package right now and did the following:
> open3d()
> plot3d(readin,col=3,type="p")
> plot3d(readin[15,],col=2,add=T,type="s",radius=0.1)
So the first plot command plotted the whole set as scatter plots and the second plot command picked the 15th row of the data and plot it as a sphere and add it to the previous canvas. I just wondering if I can make the sphere translucent so that I can see which dots a included in the sphere which means those dots are very near to the one I select.
Is there a way to do this by RGL Or you can provide me another ways to complete this task?
Thanks!
I think what you are looking for is the argument alpha.
Example
df <- data.frame(x=c(1,3,-3,-2), y=c(2,5,2,1),z=c(1,7,4,1))
library(rgl)
open3d()
plot3d(df,col=3,type="p", radius=0.5)
plot3d(df,col=rgb(1,0,0.3),alpha=0.5, add=T,type="s",radius=1)
You can plot transparent spheres using the alpha argument to spheres3d. You can rotate the plot to move the box line behind the sphere to prove it's transparent.
spheres3d(dat[4,],col=rgb(1,0,0), alpha=0.9) # transparent red.
(I tried to do it with the alpha argument to rgb but it failed.)
If you just want to find out which points are within a certain radius of point 15 then you can calculate the Euclidean distance from each point to point 15 and see which of those distances are less than the radius. No plotting needed (though you could plot those points as a different color to highlight them. The dist function is one way to compute the distances, or it is simple to program yourself.

Resources