# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1369409081 7200
# Node ID 70cbe0398c9b09b2cc7f14ee7bdef7f8e475304f
# Parent a0c4ef907d2d77a277119b8fbd8d46d4869e8645
Arrangements of pseudolines  pseudolines use the braid plot
diff git a/doc/en/reference/plotting/index.rst b/doc/en/reference/plotting/index.rst
a

b


2  2  =========== 
3  3  
4  4  .. toctree:: 
5   :maxdepth: 2 
 5  :maxdepth: 1 
6  6  
7  7  sage/plot/plot 
8  8  sage/plot/graphics 
diff git a/sage/geometry/pseudolines.py b/sage/geometry/pseudolines.py
a

b


75  75  **Felsner's Matrix** 
76  76  
77  77  Felser gave an encoding of an arrangement of pseudolines that takes `n^2` bits 
78   instead of the `n^2log(n)` bits required by the two previous encodings. 
 78  instead of the `n^2log(n)` bits required by the two previous encodings. 
79  79  
80  80  Instead of storing the permutation ``[3, 2, 1]`` to remember that line `l_0` 
81  81  crosses `l_3` then `l_2` then `l_1`, it is sufficient to remember the positions 
… 
… 

300  300  if i > 0 and seq[i1] is not []: 
301  301  i = 1 
302  302  else: 
303   i += 1 
 303  i += 1 
304  304  else: 
305  305  i += 1 
306  306  else: 
… 
… 

438  438  ... 
439  439  ValueError: There has been a problem while plotting the figure... 
440  440  """ 
441   x = 1 
442   from sage.plot.line import line 
443   from sage.plot.text import text 
444  441  
445   lines = [[(0,self._n1i)] for i in range(self._n)] 
 442  crossings = [] 
 443  
 444  ends = range(self._n) 
446  445  
447  446  for i,j in self.transpositions(): 
448   iy = lines[i][1][1] 
449   jy = lines[j][1][1] 
 447  iy = ends[i] 
 448  jy = ends[j] 
450  449  
451   lines[i].append((x, iy)) 
452   lines[j].append((x, jy)) 
 450  crossings.append(max(jy,iy)) 
 451  
 452  ends[i] = jy 
 453  ends[j] = iy 
453  454  
454  455  if abs(iyjy) != 1: 
455  456  raise ValueError( 
456  457  "There has been a problem while plotting the figure. It "+ 
457  458  "seems that the lines are not correctly ordered. Please "+ 
458  459  "check the pseudolines modules documentation, there is a " 
459   +"warning about that. ") 
 460  +"warning about that.") 
460  461  
461   lines[i].append((x+2,jy)) 
462   lines[j].append((x+2,iy)) 
463   
464   x += 2 
465   
466   L = line([(1,1)]) 
467   
468   for i, l in enumerate(lines): 
469   l.append((x+2, l[1][1])) 
470   L += line(l) 
471   
472   L += text(str(i), (0, l[0][1]+.3), horizontal_alignment="right") 
473   L += text(str(i), (x+2, l[1][1]+.3), horizontal_alignment="left") 
474   
475   return L.show(axes = False, **args) 
476   
 462  from sage.plot.braid_plot import braid_plot 
 463  braid_plot(self._n, crossings, orientation="leftright").show(**args) 
477  464  
478  465  def __repr__(self): 
479  466  r""" 