Set distance between arrow and label - dot

I have this little example code:
digraph Test {
Beginning -> Ending [label="What", labeldistance=2.0];
}
This gives me this structure:
If I remove the labeldistance=2.0, than I'm getting the same graph. How can increase the distance of the label What to the arrow so it's a little bit moved to the right?

So I found this answer which explains amongst other thinks that you just need to add spaces in front of your label... like this:
digraph Test {
Beginning -> Ending [label=" What", labeldistance=2.0];
}
and produces this:
Also, labeldistance works only on the headlabel and taillabel as you can read in the docs.

Related

How to suppress unwanted Plot figure object information in Jupyter Notebook

I want to suppress any text output when I run Jupyter Notebook cell. Specifically I output some figures and each is accompanied by something like:
<Figure size 432x288 with 0 Axes>
I have seen that if I put a ; at the end of a line, it should suppress the output, but it is not working in my case.
The code:
for i in tqdm_notebook(range(data.shape[0])):
print('BIN:',i)
fig = plt.figure(figsize=(15,4))
plt.tight_layout()
gs = gridspec.GridSpec(2,1)
ax1 = fig.add_subplot(gs[0, 0])
ax1.plot(match[window_begin:window_end],'k')
plt.vlines(i,-np.max(match[window_begin:window_end])*0.05,np.max(match[window_begin:window_end])*1.05,'r',linewidth=4,alpha=0.2)
ax1.set_xlim(0-1,post_bin_match_median[window_begin:window_end].shape[0])
ax1.set_ylim(-np.max(match[window_begin:window_end])*0.05,np.max(match[window_begin:window_end])*1.05)
plt.tick_params(axis='y', which='both', left=True, labelleft=False)
ax1.tick_params(axis='x', which='both', bottom=False, labelbottom=False)
plt.grid()
ax2 = fig.add_subplot(gs[1, 0])
fig.subplots_adjust(hspace=0.0)
ax2.plot(gp_mjds[:],gp_data[i,:],'k')
ax2.errorbar(remain, all[i,:], yerr=all_noise[i], fmt=".k", capsize=0);
ax2.fill_between(gp[:], gp2[i,:] - np.sqrt(gp_var[i,:]), gp2[i,:] + np.sqrt(gp_var[i,:]),color="k", alpha=0.2)
ax2.set_xlim(gp[0],gp[-1])
plot_y_min = np.minimum(np.min(gp2[:,:] - np.sqrt(gp_var[:,:])),np.min(all_profile_residuals[:,:]-y_noise))
plot_y_max = np.maximum(np.max(gp2[:,:] + np.sqrt(gp_var[:,:])), np.max(all[:,:]+y_noise))
ax2.set_ylim(plot_y_min,plot_y_max)
plt.grid()
plt.show()
plt.clf()
plt.close(fig);
The semi-colon would work if the typical output from the last line of the cell is what you are trying to suppress. As succinctly summarized by #kynan here, "The reason this works is because the notebook shows the return value of the last command. By adding ; the last command is "nothing" so there is no return value to show."
However, you have a loop inside a cell generating objects.
The culprit seems to be plt.clf(). Comment out that line or remove it from your code, and it should fix it.
Plus, I'd remove plt.show() as it isn't necessary when plt.clf() is removed, and I am seeing it being in the loop causing fig = plt.figure(figsize=(15,4)) to also show output text like you posted in your issue.
(I'll add for others looking at this later, that it is important have %matplotlib inline or %matplotlib notebook at the start of the cell (or at the start of a cell somewhere above this one.))
A complete guide on how to hide or remove content in Jupyter is available from the official documentation: https://jupyterbook.org/interactive/hiding.html#
For removing the single output line, you can tweak the command lines by adding a _ = [command ] assignment as suggested in this blog: https://www.tutorialguruji.com/python/suppress-output-in-matplotlib/.
The underscore there is a throwaway variable, actually an unidentified variable "when not in interactive mode". See the official Python documentation: https://docs.python.org/3.9/reference/lexical_analysis.html#reserved-classes-of-identifiers

By-step with groovy does not extract values for some node

The problem is described as following:
I want to find some interested paths and get corresponding properties of vertices or edges, the groovy I used is as following:
g.V().has("p_v_name", "d8e5d39d63c580acdb3eb188a1f4a942").
repeat(__.bothE().otherV().simplePath()).
times(3).emit().
has('p_v_tag').
path().
by(
__.project("label", "id", "p_v_black_tag").
by(__.label()).
by(__.id()).
by(__.choose(__.has('p_v_tag'),
__.properties('p_v_tag').project('value').by(__.value()).fold(),
__.constant([])
)
)
).unfold()
The above code gives me following result:
==>[label:v_user_key,id:749577404608,p_v_tag:[[value:PR016],[value:PR033],[value:PR068]]]
==>[label:e_application_id,id:4jjrk79js-9kcn170g-8ph-nvxhl4s0,p_v_tag:[]]
==>[label:v_application_id,id:1871880949872,p_v_tag:[]]
The result is unfolded for easing reading. It's just a path consisted of two nodes and one edge. The source node has a property p_v_tag, it's of multi-properties. The problem is the target node also has the property p_v_tag, but the code does not output the values.
I checked the target node has the property p_v_tag and it's not empty as following:
gremlin> g.V(1871880949872).properties('p_v_tag')
==>vp[p_v_tag->outdated]
I read the document(http://tinkerpop.apache.org/docs/current/reference) over and over but I can't figure out how to make it right, can any body help me or give me some advice?
I'm not sure why that wouldn't work. What happens if you try this workaround to replace:
by(__.choose(__.has('p_v_tag'),
__.properties('p_v_tag').project('value').by(__.value()).fold(),
__.constant([])
)
with:
by(coalesce(properties('p_v_tag').
project('value').
by(__.value()).
fold(),
constant([]))

Console not showing up on Xcode Playground 7.1.1

This is what Standard Editor looks like:
This is what Assistant Editor looks like:
This is a problem because whether I click on the eye icon or the + next to (6 times), it shows me a graph only: I was wondering if there would be a way to show more useful output?
Edit: When I show the debug area, it doesn't show any output there:
You can access the console by the menu
View > Debug Area > Show Debug Area
There's also a little upper arrow icon in the bottom left of the Playground, and the SHIFT+CMD+Y shortcut.
In the console you will be able to see not only the error messages but also anything you print.
To be able to see the output in the preview panel you have to place the statement you want to see on a separate line, and break down the logic on separate lines up to some point.
In your case, for example:
let arr = [1,2,3,4,5]
let triple = arr.map({
(i:Int) -> Int in
return i*3
})
Here with let triple ... not being on the same line as the closure anymore, the Playground is able to preview it.
And by clicking on the + on the right side, you can now unfold the special panel where all values are visible:

Move cursor up/down one line in Atom

I'm using Atom with soft wrap turned on. In most simple editors such as gedit, Ctrl-Down would be used to skip ahead to the true next line, ignoring any wrapped lines below (same as j and k in Vim).
However in Atom this shortcut produces the result of moving the line itself around, which is less useful to me. I'd like to remap Ctrl-Up and Ctrl-Down to move the cursor up or down to the next true line, as described above.
I'm familiar with editing my keymap file, but I simply can't find any command that would be the equivalent of moving ahead one full line.
You could write a custom command in your init.coffee like this:
atom.workspaceView.command 'custom:move-next-buffer-line', ->
editor = atom.workspace.getActiveEditor()
editor.moveCursorToEndOfLine()
editor.moveCursorRight()
And then just reverse it for moving to the previous buffer line. You can then map the custom command in your keymap, which you said you're familiar with.
If you're using the vim-mode-plus package, then just modify your keymap.cson file by adding
# except insert
# -------------------------
'atom-text-editor.vim-mode-plus:not(.insert-mode)':
# Motions
# -------------------------
'k': 'vim-mode-plus:move-up-screen'
'j': 'vim-mode-plus:move-down-screen'
See for details https://github.com/t9md/atom-vim-mode-plus/blob/master/keymaps/vim-mode-plus.cson

Emacs ESS Mode TAB stops indenting

I'm using Emacs 24 on Windows to write some R code. Up until about 30 minutes ago, whenever I would write a new function, ESS would automatically indent the lines following the function declaration and pressing the tab key on a new blank line would jump me to the appropriately indented starting position inside the declaration.
EG:
foo <- function() {
first line started here
second line here. .etc
}
Now, it is hard wrapping everything to the left, and not responding by automatically indenting after the function declaration or when I hit the tab key.
foo <- function() {
first line
second line
}
I've googled, but my google-fu is failing me on this. Anyone know how to restore default tab behavior to ESS in Emacs?
just for the record. Whenever such things happens, select the whole buffer C-x h and press C-M-\ to indent the whole region. This will show unambiguously the syntax error.
Try to add a space after "#".
I don't think ESS-mode handles # as a comment unless you have space after it.
I just came across the same problem you describe.
None of the above seemed to work, but I narrowed it down to using a carriage return and then an open parenthesis inside a string, like so:
### indent ( <tab> ) working fine up to here
s1 <- "string
(then this in brackets)"
### now indent does nothing!
The fact that it's balanced later doesn't help. I think EMACS reads this as opening a new expression/ block in spite of the fact that it occurs in a quoted string. This seems to apply also to expression openers { and [. It only seems to happen when the 'open expression' symbol appears at the start of the line...
In my case the string was part of a plot label, so the solution was to use \n instead.

Resources