How can I pass a variable to a ggtern vertex label? - ggtern

So I want the vertex label to update automatically when a function argument is passed to a plotting function. All the exampoles I've seen involve setting a fixed label? Is there a way to do this?

Related

Blender: split object with a shape

I've got a flat object that I want to split in multiple pieces (background: I want to print it later, but the surface of my printer is not large enough). I've modeled a simple puzzle-shape:
I would like to use this shape to cut through my object, but if I use the boolean modifier, blender generates vertexes where the shape and the object intersects, but it won't cut the object since my shape got a thickness of 0:
I don't want to make my shape thicker, because otherwise it would delete something of my object...
You are able to separate the two sides of the object from each other, and then rejoin them afterwards if you need to. (This does include the use of the boolean modifier)
First, you should add the boolean modifier to the main mesh where you want it, with the 'difference' operation. Then in edit mode, as you explained before, the vertexes are created but there isn't the actual 'cut' that you were looking for.
I recreated the scenario with a plane intersecting a cube:
This is what it looks like in edit mode after having applied the boolean modifier:
Second what you can do is (after applying the boolean modifier) select the faces you want to be separated in edit mode. Then, pressing P (shortcut for separate, you can get to it by right clicking) click on 'selection' and you should have two separate objects. One of the objects will have what looks like a missing face: If you wanted two separate objects, then you just need to add a face on the object with the missing face and you can look no further. If you wanted separate parts of objects that are separate within edit mode (all together one object in object mode) then you can select the two objects and press crtl+j. Hope this helps somehwhat!
I have selected half of the cube that I want cut out (the selection does not include the face in the middle):
There are now two objects, completely seperated from each other:

Is there a way to set default values for matplotlib's colorbar?

I'm wondering if it's possible to change the default padding value of matplotlib's colorbar. Since I'm always setting pad=0, e.g.,
db = colorbar(sc, ax=ax[1], pad=0)
it would be convenient to set this value by default, so that I don't need to add it in the colorbar's function call every single time. I haven't found any hints/solutions in the rcParams-related docstrings.
Is it even possible to change the default values of the colorbar (like we do in case of, e.g., imshow by manipulating rcParams)? If so, how can we do that?

How to assign a label to go.layout.Shape(type="line"...)?

I produce the following figure.
The figure has a number of add_trace applied to it with go.Scatter as arguments.
A list of 4 go.layout.Shape, type="line", with fixed color attributes, is created and the figure layout is updated with that list: fig.update_layout(..., shapes=...)
The traces have labels assigned to them that we can see to the extreme right.
Is there a way to add labels to assign to the lines as well?
You would like your lines to appear in the legend of the figure (https://plot.ly/python/legend/). However, only traces can appear in the legend, not shapes which are a kind of annotation. What you could do is to create the lines using go.Scatter(..., mode='lines'), and then they would appear in the legend. You just need to give the starting and end points in go.Scatter (see https://plot.ly/python/line-and-scatter/).

What is "index" in NSGradient getColor:location:atIndex?

In the following NSGradient method:
- (void)getColor:(NSColor **)color location:(CGFloat *)location atIndex:(NSInteger)index
What is index? The documentation says index of the colour I want. But I thought the point of this method is that it tells YOU the colour to use for a particular location ? I don't know the index.
I want to define a gradient (colors and locations), and given a float return the corresponding colour.
Does anyone have an example where a gradient is defined, and this method is called ?
As the docs say,
This method returns the color stop information that was used to create the receiver. It does not return the interpolated color values at any point along the gradient.
The index is into the initial array of colors that you used to create the gradient. The location parameter isn't one that you pass in; it's an out parameter like color, and will give you the location (which you also specified when creating the gradient) associated with the color stop at the index you pass.
It sounds like you're looking for interpolatedColorAtLocation:

Is it possible to replace an axis with a parasiteaxis?

I have code that requires a ParasiteAxis instance, or at least something with a toggle_axisline method, in order to function properly. I'd like to be able to pass it any arbitrary axis created in any way (e.g., through a simple plot call).
How can I convert any given axis instance into a ParasiteAxis or HostAxis instance?
(for a specific use-case, see issue https://github.com/aplpy/aplpy/pull/88 and specifically the workaround implemented in commit https://github.com/keflavich/aplpy/commit/02ecd5386f7d3a93ca8e60c3db2b34ff3216060a)