简体   繁体   English

python上的鱼骨图

[英]Fishbone diagram on python

I was trying to create a Fishbone Diagram also known as cause and effect diagram or Ishikawa diagram on Python. Can anyone help me to make it more like standard fishbone diagram?我试图在 Python 上创建一个鱼骨图,也称为因果图或石川图。任何人都可以帮助我使它更像标准鱼骨图吗? im not really familiarized with the dot language, and the script i used was from a previous post in the forum我不太熟悉 dot 语言,我使用的脚本来自论坛的前一篇帖子

This is what i have done so far And this i what i want这是我到目前为止所做的这就是我想要的

       graph W {
      graph [splines=line]
      node [shape=underline]
      {
        rank=same
        node [shape=rect style=invis centerline=true]
        edge [headclip=false tailclip=false]
        p1 [group=g1]
        p2 [group=g2]
        p3 [group=g3]
        pstart:c -- p1:c --  p2:c --  p3:c
        pend [label=" Defect XXX" shape=plain style=solid]
        p3:c -- pend:w [dir=forward arrowhead=normal]
      }
      {
        rank=min
        node [shape=plain]    
        measurements  materials personnel
      }
      {
      node [group=g1]
      measurements:se -- calibration:e -- microscopes:e -- inspectors:e
      inspectors:e -- p1:c  [headclip=false]
      }
      {
      node [group=g2]
      materials:s--alloys:e--Lubricants:e--Suppliers:e 
      Suppliers:e -- p2:c [headclip=false]
      }
      {
      node [group=g3]
      personnel:s--shifts:e--training:e--operators:e--"another thing":e -- p3:c [headclip=false]
      }
      {
        rank=max
        node [shape=plaintext]
        Environment Methods Machines
      }
      {
      node [group=g1]
      p1 -- Humidity:e [tailclip=false]
      Humidity:e -- temperature:e -- Environment:n
      }
      {
      node [group=g2]
      p2 -- Angle:e  [tailclip=false]
      Angle:e --Engager:e-- Brake:e-- Methods:n 
      }
      {
      node [group=g3]
      p3 -- "blade wear":e  [tailclip=false]
      "blade wear":e -- speed:e -- Machines:n
      }
    }
   

 BEGIN{int nIndx=0;
  float centerY=-999.9, dY, angleAdj, minY=9999, maxY=-9999;
  node_t Node[];
  graph_t theRoot, subG;
  void doErrs(string eString){
     printf(2, "Error:: %s\n", eString);
     print("// Error:: %s\n", eString); // temporary, for debugging
  }
}
N{
   Node[++nIndx]=$;
   if ((hasAttr($, "centerline")) && ($.centerline!="")){
      centerY=$.Y;
   }
   if ($.Y >maxY)
     maxY=$.Y;
   if ($.Y < minY)
     minY=$.Y;
}

    END_G{
      if (centerY==-999.9){
          estr="\"centerline\" attribute is missing"; doErrs(estr);;
          exit(9);
      }
      $G.bb="";
      for (Node[nIndx]){
        print("//  pos before: ",Node[nIndx].pos);
        dY=Node[nIndx].Y-centerY;
        print("//  dY (1) : ", dY);
    
        if (dY<0){
          dY=-dY;
        }
        print("//  dY (2) : ", dY);
        Node[nIndx].pos=(string)(Node[nIndx].X - .25*dY) + "," + (string)Node[nIndx].Y;
        print("//  pos after: ", Node[nIndx].pos);
      }
    }

This has been answered here: fishbone diagram using Python or graphviz这已在此处得到解答: 使用 Python 或 graphviz 的鱼骨图

All in all, I suggest using pikchr ( https://pikchr.org/home/doc/trunk/homepage.md )总而言之,我建议使用pikchr ( https://pikchr.org/home/doc/trunk/homepage.md )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM