Questions tagged [line]

The shortest distance between two points. Or, a row of characters in text output.

is mostly used in below context:

  • text line or command line in text processing context;
  • line drawing or plotting in visualization or image-processing context
  • analytic geometry

For the LINE-API / LIFF use line-api or line-messenger

6255 questions
49
votes
1 answer

Change spacing of dashes in dashed line in matplotlib

In Python, using matplotlib, is there a way to change the distance of the dashes for different linestyles, for example, using the following command: plt.plot(x,y,linestyle='--')
grover
  • 927
  • 1
  • 10
  • 21
49
votes
3 answers

More than six shapes in ggplot

I would like to plot lines with different shapes with more than six sets of data, using discrete colors. The problems are 1) a different legend is generated for line color and shape, but should be only one legend with the line color and shape, 2)…
user3969377
48
votes
3 answers

How can I format a list to print each element on a separate line in python?

How can I format a list to print each element on a separate line? For example I have: mylist = ['10', '12', '14'] and I wish to format the list so it prints like this: 10 12 14 so the \n, brackets, commas and '' is removed and each element is…
user1825241
  • 846
  • 4
  • 9
  • 17
48
votes
8 answers

PowerShell get number of lines of big (large) file

One of the ways to get number of lines from a file is this method in PowerShell: PS C:\Users\Pranav\Desktop\PS_Test_Scripts> $a=Get-Content .\sub.ps1 PS C:\Users\Pranav\Desktop\PS_Test_Scripts> $a.count 34 PS C:\Users\Pranav\Desktop\PS_Test_Scripts>…
Pranav
  • 675
  • 1
  • 8
  • 13
47
votes
5 answers

Drawing Dashed lines on HTML5 Canvas?

I would like to draw some dashed lines on HTML5 canvas. But I couldn't find there is such a feature. the canvas path could only draw solid lines. And people have tried to use some border feature (dotted, dashed) in CSS to draw dashed lines, but they…
April Lee
  • 563
  • 1
  • 5
  • 10
46
votes
3 answers

change line height in sublime text default theme after changing the font-size

I found this link on stackoverflow: Sublime Text 2 how to change the font size of the file sidebar? I followed the directions and changed the font size, but now the font is too big with too small of a line height, so it looks stacked on top of each…
Masu
  • 1,568
  • 4
  • 20
  • 41
44
votes
1 answer

Drawing Multiple Lines in D3.js

Up until now, I've been using loops to add line elements to a D3 visualization, but this doesn't seem in the spirit of the API. Let's say I have got some data, var data = {time: 1, value: 2, value2: 5, value3: 3,value4: 2}, {time: 2,…
winter
  • 441
  • 1
  • 4
  • 5
44
votes
3 answers

Bash get last line from a variable

If I have a variable with multiple lines (text) in it, how can I get the last line out of it? I already figured out how to get the first line: STRING="This is a multiple line variable test" FIRST_LINE=(${STRING[@]}) echo "$FIRST_LINE" #…
Matt Backslash
  • 764
  • 1
  • 8
  • 20
42
votes
9 answers

3D Line-Plane Intersection

If given a line (represented by either a vector or two points on the line) how do I find the point at which the line intersects a plane? I've found loads of resources on this but I can't understand the equations there (they don't seem to be standard…
jt78
  • 906
  • 2
  • 10
  • 22
42
votes
7 answers

How to make a dashed line in swift?

I want to know how to make a dashed line in swift like this: - - - - - - - - instead of a regular straight line like this: ----------------, I know that i can make multiple lines but that will require so much unnecessary code if i can just write it…
A. Steiness
  • 423
  • 1
  • 4
  • 7
41
votes
4 answers

Infinite horizontal line in Bokeh

Is there a way to plot an infinite horizontal line with Bokeh? The endpoints of the line should never become visible, no matter how far out the user is zooming. This is what I've tried so far. It just prints an empty canvas: import bokeh.plotting…
Tobias Hotzenplotz
  • 1,177
  • 1
  • 11
  • 15
41
votes
10 answers

Delete final line in file with python

How can one delete the very last line of a file with python? Input File example: hello world foo bar Output File example: hello world foo I've created the following code to find the number of lines in the file - but I do not know how to delete the…
torger
  • 2,308
  • 4
  • 28
  • 35
41
votes
1 answer

Python fastest way to read a large text file (several GB)

i have a large text file (~7 GB). I am looking if exist the fastest way to read large text file. I have been reading about using several approach as read chunk-by-chunk in order to speed the process. at example effbot suggest # File:…
Gianni Spear
  • 7,033
  • 22
  • 82
  • 131
40
votes
9 answers

How do I get the last non-empty line of a file using tail in Bash?

How do I get the last non-empty line using tail under Bash shell? For example, my_file.txt looks like this: hello hola bonjour (empty line) (empty line) Obviously, if I do tail -n 1 my_file.txt I will get an empty line. In my case I want…
Debugger
  • 9,130
  • 17
  • 45
  • 53
40
votes
4 answers

Search and get a line in Python

Is there a way to search, from a string, a line containing another string and retrieve the entire line? For example: string = """ qwertyuiop asdfghjkl zxcvbnm token qwerty asdfghjklf …
Ben
  • 16,275
  • 9
  • 45
  • 63