I have a set of scatter points which I want to connect, as shown below. I want to connect the points, but I want to hide the origin while keeping the point (x1, y1). How do I do this?
fig.add_trace(go.Scatter(x=[0, x1], y=[0, y1])
You can set the opacity of the markers to a value between 0 and 1; 0 meaning invisible, and 1 meaning totally opaque
fig=go.Figure()
data=[0,1,2]
dot_opacity=np.ones(len(data))
dot_opacity[0]=0
fig.add_trace(go.Scatter(x=[0, 1,3], y=[0, 1,2], marker=dict(opacity=dot_opacity)))
fig.add_trace(go.Scatter(x=[0, x1], y=[0, y1], alpha=0)
set alpha between 0 to 1
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html
You can use mode parameter to hide markers as follows:
fig.add_trace(go.Scatter(x=[0, x1], y=[0, y1], mode="lines")
The API reference of Scatter states:
mode – Determines the drawing mode for this scatter trace. If the provided mode includes “text” then the text elements appear at the coordinates. Otherwise, the text elements appear on hover. If there are less than 20 points and the trace is not stacked then the default is “lines+markers”. Otherwise, “lines”.
Related
In the attached Google charts Pie chart the labels fit well inside the segments. Determining the length of a bit of text in HTML5 canvas is easy enough - but how do you determine whether the label will fit into a particular segment (using trigonometry) ? As you can see on the image, two of the segments don't have labels inside the segment.
EDIT: Here's an example of what I have at the moment: https://www.rgraph.net/tests/canvas.pie/in-pie-labels.html
As you see the labels for the small segments overlap. What I'm after is a way to calculate whether there's enough space for the labels at the point where they're going to be rendered. If not, I can just not draw the label like in the example image above.
Could chord size be useful to do this?
Here's the forumulae for the chord size that I found via Google:
"Chord length using trigonometry = 2 × r × sin(θ/2); where 'r' is the radius of the circle and 'θ' is the angle subtended at the center by the chord."
I sorted it (in about one hour) after 3 days of trying to calculate it with trig by using the built-in context.isPointInPath() function...
Draw the text (transparent color) to get the coordinates (x/y/w/h) of it. You might be able to get away with measuring it to get the width and height.
Draw the segment in a transparent color and do not stroke or fill it. Also, do not close the path.
Test each corner of the text rectangle (formed the x/y/w/h that you got above) using the context.isPointInPath() function. If the function returns true for each corner of the rectangle formed by the coordinates of the text, then the text will fit into the segment.
I am using Autodesk.Viewing.Markupscore extension to draw a polygon in 3D view in top view (orthographic)
I want to see only those elements which are inside the polygon
For which I am using the cutplanes concept because bounding box logic is taking too long to process.
So Please suggest a way to apply cut planes along these lines.
Try programmatically cutplanes with an array of vector4s specifying the four sides say:
vectorArray.push(new THREE.Vector4 (0.9999999999999998, 0, 0, 0.06520926952362059)) //x,y,z,w
viewer.setCutPlanes(vectorArray)
See documentation here
Is there a way to change the style of the white squares that are used as vertex handles by default when a polyline is set to editable:true?
I can see that changing the stroke of the polyline affects those handle squares, but I'd like to either change the shape of handle (e.g. to a circle), or substitute an image.
The only way I've managed to found is a direct manipulation of DOM elements corresponding to those markers. For instance, they may be selected using
$('div').filter(function() {
return $(this).css('width') == '11px';
})
Probably, more reliable approach is a DOM tree traverse starting from $('.gm-style') element.
In my application i want to show two or more points in the google maps and also need to draw a line between them. I want this to show by a tag of html. How can i do it??
So you need to use the static maps API.
Here's an example with markers and a polyline:
<img src="http://maps.googleapis.com/maps/api/staticmap?
size=500x300
&sensor=false
&markers=color:green|label:1|51.511333,-0.119355
&markers=color:blue|label:2|51.507801,-0.107569
&markers=color:red|label:3|51.510999,-0.104297
&path=color:0xff0000ff|weight:5|51.511333,-0.119355|51.506205,-0.114462|51.507774,-0.10861|51.507801,-0.107569|51.5071,-0.107344|51.507207,-0.105016|51.507507,-0.104404|51.510999,-0.104297">
The last line starts off setting the attributes for the polyline, i.e. its color is red (ff0000). The last 'ff' indicates it's 100% solid, but you can vary these last two characters anywhere between 00 - FF (base 16) to go between 0 - 100% opacity (or if you leave those last two characters off entirely, it'll default to 50% opacity). It has a weight (thickness) of 5.
After that, it's just a list of coordinates for the polyline, each one separated by a |
Check the documentation: https://developers.google.com/maps/documentation/static-maps/intro#Paths
RS2008 - pie chart
I have 'outside' labels with lines pointing to the segment (although strangely this only appears to work in pdf output)
However (see pic below) the label is appearing outside the scope of the chart area
How can I force it to remain inside? (MinimumRelativePieSize is set to 70)
(pic below missing due to not being able to find an image host that isn't blocked by corp firewall)
Picture a pie chart of 25 slices, with radial lines that project through the sides.
The line from each slice then becomes horizontal, before disappearing outside.
(above actually fits tune of "Lucy in the Sky with Diamonds")
I set MinimumRelativePieSize to 50 and it seems to work ok.
I guess they need to implement a MaximumRelativePieSize property.