Resolving space problem after legend