@Override
    public String getCode() {
        double x = getCentreX()/50;
        double y = getCentreY()/50;
        
        double maxY = 0;
        double minX = 0;
        double minY = 0;
        double[] graphSize = getGraphSize();
        if(graphSize != null){
            maxY = graphSize[1]/50;
            minX = graphSize[2]/50;
            minY = graphSize[3]/50;
        }
        
        x -= minX;
        
        //double middleY = (maxY + minY)/2;
        
        //if(y == middleY) y = 0;
        //else y = middleY - y;
        
        if(y == maxY) y = 0;
        else y = maxY - y;
        
        String comments = getComments();
        String newLine = System.getProperty("line.separator");
        
        String nameCode = getLabel().replaceAll("\\\\", "\\\\textbackslash ");
        if (!comments.isEmpty())
            return comments + newLine + "\\cnodeput[linecolor="+
                    getNodeColourString()+",linewidth=" + getLinewidth() +
                    ",linestyle="+lineStyle+"](" 
                    + x +","+y+"){"+getNodeID()+"}{"+nameCode+"}";
        
        return "\\cnodeput[linecolor="+getNodeColourString()+",linewidth=" + 
                getLinewidth() + ",linestyle="+lineStyle+"](" 
                + x +","+y+"){"+getNodeID()+"}{"+nameCode+"}";
        
    }