Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating specific graph


    Dear all,

    I am wondering if it is possible to create the following graph. This is actually a list of the data, where I want to indicate with a bullet if the value of each variable is greater or equal to 1 and if possible fill in the rest of the cells with a colour.

    The data corresponding to the attached graph are:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str4 t float(i1 i2 i3)
    "t1"  .5  .5 1.5
    "t2" 1.1 1.2   5
    "t3"   1  .2  .3
    end
    Thank you in advance for your valuable time.

    Kind regards,
    Nikos


    Click image for larger version

Name:	table_example.jpg
Views:	1
Size:	10.7 KB
ID:	1391919

  • #2
    Nikolaos Kanellopoulos you could likely do this by writing a LaTeX file (I've used a similar strategy to color code cells in a table while I was working in Mississippi). I also put together a Mata library for constructing HTML documents that could be used similarly to define <td> elements with the appropriate styling to accomplish the same goal. Both instances, however, require familiarity with other languages. You could also use conditional formatting in MS Excel and insert the values into the cells where the formatting logic is to be applied.

    hope this helps

    Comment


    • #3
      The asciiplot package produces similar output. Perhaps you could learn how to do this from studying the asciiplot ado-file.
      Code:
      ssc d asciiplot

      Comment


      • #4
        One way, if you don't mind using squares; rearrange data using standard commands, then scatter with a large square marker symbol:
        Click image for larger version

Name:	myfile.png
Views:	1
Size:	5.6 KB
ID:	1394942


        Code:
        ********************************************************************************
        clear all
        input str4 t float(i1 i2 i3)
        "t1"  .5  .5 1.5
        "t2" 1.1 1.2   5
        "t3"   1  .2  .3
        end
        ********************************************************************************
        
        drop t
        
        foreach v of varlist i? {
        
            replace `v' = ( `v' >= 1 )
        }
        
        xpose , clear
        stack v? , into(tf) clear
        rename _stack r
        gen sorder = _n
        bysort r (sorder) : gen c = _n
        replace r = 1 + 3 - r
        replace r = r - .5 
        replace c = c + .5      
        keep r c tf
        
        ********************************************************************************
        #delim ;
        
        tw scatter r c if tf==1 , 
        
            msize(10) mc(black) 
          
          ||  
           
          scatter r c if tf==0 ,  
           
            m(square) msize(20) mc(gs12)
               ysize(2) xsize(2) ysc(off) xsc(off) leg(off)  
            ylab(0(1)4, grid gmin gmax nogextend glcolor(black)) 
            xlab(0(1)4, grid gmin gmax nogextend glcolor(black))
            graphregion(style(none)) plotregion(style(none))
            scheme(s1color)
            
            text( 3.5 1.5 "i1"
                  3.5 2.5 "i2"
                  3.5 3.5 "i3" , size(huge))
                  
            text(    3.5 0.5 "t"  
                    2.5 0.5 "t1"
                    1.5 0.5 "t2"
                    0.5 0.5 "t3" , size(huge))       
        ;
        #delim cr
        ********************************************************************************

        Comment


        • #5
          Dear All,

          thanks for the suggest solutions.

          Hope they will help others with similar problems in the future.

          Regards,
          Nikos K.

          Comment

          Working...
          X